Hello,
I am starting Excel and running a macro from a script; I need to save the workbook without the macro and as a .xls or .xlsx - the workbook is sent to a folder for an accounting department and the macro must not be included; the workbook must open without any complaint such as "Excel cannot open the file "workbookname" because the file format or file extension is not valid. Verify that the file has not been corrupted and the the file extension matches the format of the file."
The save as can be done in the VBScript?
Thanks!
delete macro and save as
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: delete macro and save as
You could run a macro like this. Make sure that you have saved the workbook (with macros) before you run the macro, otherwise you'll lose it.
You can replace "test.xlsx" with the path and filename of your choice.
Code: Select all
Sub SaveWithoutMacros()
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "test.xlsx", FileFormat:=xlOpenXMLWorkbook
Application.DisplayAlerts = True
MsgBox "Done!"
End Sub
Best wishes,
Hans
Hans
-
- NewLounger
- Posts: 12
- Joined: 20 May 2015, 22:43
Re: delete macro and save as
Thanks! I tried it out and it works.