Good day, I have the below REALLY simple code to save a sheet in a workbook as CSV for upload to a database, however I keep getting the Run-time error "1004" Method "SaveAs" when I try and execute it. I can't figure out what I have got wrong - any advise?
Thanks
Thanks
VBA Code:
Sub SaveCSV()
Application.DisplayAlerts = False
ThisWorkbook.Sheets("Export").Copy
x = Weekday(Date, vbSunday)
Select Case x
Case 1
x = 2
Case 2
x = 3
Case Else
x = 1
End Select
ActiveWorkbook.SaveAs FileName:="File saved on " & _
Format(Date - x, "mm-dd-yyyy"), FileFormat:=xlCSV, CreateBackup:=True
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub