I want to:
Another option (only tested on latest versions of excel).
The Macros are not deleted until the workbook is closed after a SaveAs
.xlsx
so you can do two SaveAs
in quick succession without closing the workbook.
ActiveWorkbook.SaveAs FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False, ConflictResolution:=xlLocalSessionChanges
Application.DisplayAlerts = True
Note: you need to turn off the DisplayAlerts
to avoid getting the warning that the workbook already exists on the second save.