Actually I mean In my application I've an AUTO_OPEN routine.
When the SHIFT KEY is pressed while opening the application, the AUTO_OPEN will be disabled.
I want to check if the SHIFT key was pressed and if so call AUTO_OPEN.
Or - the standard workaround is that the auto_open macro unhides all sheets except for a front sheet that says "You need to enable macros to use this workbook"
the sheets would be xlveryhidden on workbook close. As xlveryhidden sheets can only be unhidden thru code, this makes a very effective little protection routine to make sure that macros are enabled and the auto_open macro is executed Rgds
Geoff
Vah! Denuone Latine loquebar? Me ineptum. Interdum modo elabitur
eg
In the before_close event
For each sh in thisworkbook.sheets
if sh.name <>"MacroDisabledFrontPage" then
sh.visible = xlveryhidden
else
sh.visible = true
end if
In the auto_open sub
sub auto_open()
for each sh in thisworkbook.sheets
if sh.name <> "MacroDisabledFrontPage" then
sh.visible = true
else
sh.visible = xlveryhidden
end if
other code goes here
end sub
If the wb is opened with shift held down then the auto_open will not run and therefore, all sheets except the sheet that tells the user that they need to enable macros are hidden. ie the workbook cannot be used
If the user does not press shift then the macro executes and all relevant sheets are unhidden (and the info sheet is hidden)
Basically, it renders the workbook useless unless the auto_open macro is allowed to run
You should also protect the VBA project so that they cannot get into the VBE and unhide the sheets via code Rgds
Geoff
Vah! Denuone Latine loquebar? Me ineptum. Interdum modo elabitur
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.