TLDR:
How do I save a Excel-File-with-Macros as an Excel-File-without-Macros using VBA suppressing the prompt that the target format does not support macros?
I have a xlsb file (Excel 2007+ with Macros), inside is the content and a button that should save that file as an xlsx (Excel 2007 WITHOUT Macros). So far, so good. I'll use ActiveWorkbook.SaveAs FileName:=name, FileFormat=xlOpenXMLWorkbook, Password="xyz"
But that always generates a prompt that tells the user that saving data in the target format means loosing the macro data and if he/she wants to continue...
I've tried Application.DisplayAlerts = False
and ThisWorkbook.CheckCompatibility = False
. I've also recorded the same action with the MacroRecorder that also seems unable to skip the upcoming prompt.
My last try was a copy of the content using ThisWorkbook.Sheets.Copy
and trying to remove the VBProject data. Tried various ways but it seems that the vb-project data can't be really removed. After executing remove and stuff like that the debugger shows always three items of vb-project-data.
I'll check this tomorrow, but it looks very much like the code I've tried... Macro to save active Sheet as new workbook, ask user for location and remove macros from the new workbook