I have some VBA code that saves the spreadsheet under a given filename. Whenever I save it, I get a warning message about “significant loss of functionality”, because there’s data validation in the sheet (although the validation still works after I’ve saved the sheet).
I want to suppress this warning, but I don’t think I should use
Application.DisplayAlerts=false
mySheet.saveAs myFilename
Application.DisplayAlerts=true
because I don’t want to override the warning that tells the user a file with this name already exists, as I want to protect users from accidentally saving over files). How can I specify that I just want to override the “loss of functionality” warning?
EDIT: I saw an answer to a similar question that recommended saving the workbook in a different format. That won’t work here because I’m developing in Excel 2007 but trying to accommodate users who have Excel 2003.
You can catch the save event and then prompt the user for information. Here’s a quick, untested example I threw together for you:
gbUserGenerated would just be a global variable (boolean) that tells you if you created the workbook or if it was the user (if the user always creates the workbook then you wouldn’t really need it).
Put the code in the Microsoft Excel Object folder in the VBE, put it in the “This Workbook” Module.
To learn more about events go here:
http://www.cpearson.com/excel/Events.aspx