Each week I load CSV data into my Workbook from a USB stick.
I have recently chosen to archive the CSV file with the date that the data is accessed.
The source file, no matter what the date, is always the same name.
I can successfully archive the CSV using this statement:
As I am repeatedly tweaking code and layouts within the Workbook I need to access my USB stick but when my macro finds that an archived file of the daily date exists I receive and error.
I created an IF …THEN to check if the file by that date name exists:
Unfortunately if the filename does not exist the file is not created.
What simple means might allow my IF … THEN to do as I intend?
I have recently chosen to archive the CSV file with the date that the data is accessed.
The source file, no matter what the date, is always the same name.
I can successfully archive the CSV using this statement:
Code:
ActiveWorkbook.SaveAs Filename:="C:\DIR\CSV\Filename" & Format(Date, "yyyymmdd") & ".csv", FileFormat:=xlCSV, CreateBackup:=False
As I am repeatedly tweaking code and layouts within the Workbook I need to access my USB stick but when my macro finds that an archived file of the daily date exists I receive and error.
I created an IF …THEN to check if the file by that date name exists:
Code:
If "C:\DIR\CSV\Filename" & Format(Date, "yyyymmdd") & ".csv" = "" Then
ActiveWorkbook.SaveAs Filename:="C:\DIR\CSV\Filename" & Format(Date, "yyyymmdd") & ".csv", FileFormat:=xlCSV, CreateBackup:=False
End If
What simple means might allow my IF … THEN to do as I intend?