I have a spreadsheet with a lot of VB in it and I need to limit any user from saving it as a new version of Excel(2000 or higher). Does anyone know how to limit this to just the Excel 97 version through code or another means?
I think you are out of luck, in reality. Please explain the exact situation, and why this is a problem.
You can put code in Workbook_BeforeSave, checking Application.Version. You can prevent the save or allow the save. But saving to a specific Excel 97 version? Not exactly sure about that. XlFileFormat has a slew of various formats, but I am not exactly sure that FileFormat:=xlExcel9795 will solve your problem.
I know that compiling in 2002 will have problems when the code runs in 97, but the code remains the same.
In the workbook_BeforeSave
just put cancel = true
Then, write your own sub (you can record it) for saving and attach it to a button that says "SAVE" or similar
Within that code, at the start, put:
application.enableevents = false
This will stop the BeforeSave event from firing
and at the end
application.enableevents = true
Rgds
Geoff "Some cause happiness wherever they go; others whenever they go."
-Oscar Wilde
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.