kris_sk2012
asked on
Remove VB code from saved Excel file
My excel macro is executed from command line using Workbook_Open()
At the end of the macro, the template file from where the code is running, saves a output file with date time stamp.
But the output file has the code as well, and when I open the output file, Workbook_Open() executes again with error.
How can I save the output file with out copying over the VB code/macro?
At the end of the macro, the template file from where the code is running, saves a output file with date time stamp.
But the output file has the code as well, and when I open the output file, Workbook_Open() executes again with error.
How can I save the output file with out copying over the VB code/macro?
ASKER
I'm using Excel 2010.
The code in the VB script that saves the new file is
ThisWorkbook.SaveAs ThisWorkbook.Path & "\Report_" & getDateTimeStamp() & ".xls", XlFileFormat.xlExcel8
What needs to change above to save the workbook without macros or code carried over?
The code in the VB script that saves the new file is
ThisWorkbook.SaveAs ThisWorkbook.Path & "\Report_" & getDateTimeStamp() & ".xls", XlFileFormat.xlExcel8
What needs to change above to save the workbook without macros or code carried over?
Hi kris,
You should try copying the workbook and then saving the copied version which doesn't include the VB code. Please refer to the last post by "johnske" here:
http://www.vbaexpress.com/forum/showthread.php?t=17337
Regards,
urzica
You should try copying the workbook and then saving the copied version which doesn't include the VB code. Please refer to the last post by "johnske" here:
http://www.vbaexpress.com/forum/showthread.php?t=17337
Regards,
urzica
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Works perfect!!!
If using 2007 or later the original file will be an xlsm (macro enabled). If you save as an xls it will save without the macros.
Thanks
Rob H