Is it possible using VBA to save a *.XLSM file as a *.XLSX file programmatically. Doing the SaveAs manually requires acknowledging a dialog that indicates all VBA will be lost in the process.
Using VBA code like:
XLSX_Filename = TempFilePath & TempFileName & TempFileExt
wb2.SaveAs XLSX_Filename, FileFormat:=xlopenxmsworkb
Produces the error:
Runtime Error 1004: "Method 'SaveAs' object '_workbook' failed
and using "Application.DisplayAlerts
= False" does not seem to bypass the underlying dialog / problem.
The goal is to build and email a temporary file using selected worksheets from a *.XLSM file and not include the VBA in the emailed workbook. One option is to use the Microsoft Visual Basic For Applications Extensibility 5.3 as documented here: http://www.cpearson.com/excel/vbe.aspx
to remove all the VBA from the workbook being emailed but I dont know if our virus scanner will eventually cause problems with this type of code. Alternate syntax or other options?