View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Prevent disabling of macros?

Richard,
That's the only way.
You have to leave the WB in such a state (using the _BeforeSave and/or _
BeforeClose) that if macro are NOT enabled, the user sees only the advice
sheet and cannot interact with the other sheets.
If you could interact with the Macro Security settings, then any virus
writer could also.

NickHK

wrote in message
oups.com...
Dear All

Does anyone know how to prevent a workbook from opening if the user
chooses to disable macros? (eg they have the Security Level set to
'high').

I want to use code to provide certain protections to spreadsheets (for
example, to ensure that users can't copy and paste data). But if the
user opens without enabling macros, they can bypass these extra
protections.

I have thought of one way:
Upon saving, hide all sheets except for one sheet with a message on it
"In order to use this spreadsheet, you must enable macros". Upon
opening, code unhides the other spreadsheets and hides the first sheet.
When combined with Protect Workbook Structure this works, kind of.
But it's pretty clumsy and looks a bit confusing to the user (they get
a brief period of time to read the first sheet when the book loads).

Cheers
Richard