Question

I am trying to save the active workbook using vba as an xlsb file...with its current name and add "_current date".

ActiveWorkbook.SaveAs "C:\Users\sxj2030\Documents\BC Validations\Fixed\" & ActiveWorkbook.Name & "_" & Format(Date, "MMMddYYYY"), FileFormat = xlExcel12

I am getting the "Method 'SaveAs'of object'_WorkBook' Failed" error an I'm at a loss as to why

Was it helpful?

Solution

You are getting this error due to you missing a colon after the fileFormat parameter.

It should be FileFormat:=xlExcel12


Also you should append the file extension

"C:\Users\sxj2030\Documents\BC Validations\Fixed\" & _
 ActiveWorkbook.Name & "_" & Format(Date, "MMMddYYYY") & ".xlsb"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top