Is it possible to check if a csv file has any data in it from VBA?? I want to import CSV file to access. It works fine if there is data in the CSV file but error occurs when there is no data in the CSV file.
Asked
Active
Viewed 1,650 times
1 Answers
3
You can use the FileLen function:
If FileLen("C:\your_dir\file_to_read.csv") = 0 Then MsgBox "Csv file is empty"

Tr1stan
- 2,755
- 1
- 26
- 45
-
Thanks @Fionnuala. Your suggestion would have worked well too, however sometimes you find that the `Scripting.FileSystemObject` object isn't always available. See [here](http://stackoverflow.com/questions/5457000/error-activex-component-cant-create-object-scripting-filesystemobject) – Tr1stan Jul 21 '15 at 08:04