Kelvin Stott
Active Member
- Joined
- Oct 26, 2010
- Messages
- 338
Hello,
In order to protect my VBA code, I am trying to get my xlsm workbook to save itself without macros, but under the same xlsm filename...
I have tried the following code, and many variants, but I get a run-time error '1004': "Method 'SaveAs' of object '_Workbook' failed"
So how do I get an xlsm workbook to save itself under the same xlsm filename, but without any macros?
Any help would be much appreciated, thanks.
In order to protect my VBA code, I am trying to get my xlsm workbook to save itself without macros, but under the same xlsm filename...
I have tried the following code, and many variants, but I get a run-time error '1004': "Method 'SaveAs' of object '_Workbook' failed"
VBA Code:
Application.DisplayAlerts = False
ThisWorkbook.SaveAs Filename:=ThisWorkbook.FullName, FileFormat:=xlOpenXMLWorkbook
Application.DisplayAlerts = True
So how do I get an xlsm workbook to save itself under the same xlsm filename, but without any macros?
Any help would be much appreciated, thanks.