I have a EXIF program which downloads all the information related to pictures. When I run the EXIF program it creates a .csv file and I copy and paste to Worksheet. The next time I run the program, it stops and says I have to remove the .csv file before it can continue. I need to delete all.csv files or rename the one so it can continue. A Excel AddIn to Delete a file located on the Ribbon would easily work also.

Macro to Delete or Rename .csv File
- JohnDrew
- Thread is marked as Resolved.
-
-
-
-
It does not like the Kill Statement
Sub KILL()
KILL "C:\*.csv"
End Sub
Wrong number of arguments or Invalid Property Assignment -
-
It runs but does not delete the file
Sub KILLS()
Shell "cmd /c del c:\*.csv", vbHide
End Sub -
Works fine for me.
Even though I am the admin, I still can't put files into the root folder c:\.
Maybe you did something prior to that locked a csv file? When shelling to an external program like EXIF, it is best to use ShellExecute() rather than Shell() to allow time for the execution to finish.
e.g.
http://www.cpearson.com/Excel/ShellAndWait.aspx
or
http://www.mvps.org/access/api/api0018.htm -
When I ran the EXIF file it generated the Image number and Date Taken. Then it created a .csv file. I copied the data to my spreadsheet but never closed the .csv file. It gave me no errors, therefore I thought it was an error in my VBA.
Wrote a Macro to Delete before running the download. Thanks Ken for your usual support.
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!