Determining if Macro Can Run

  • Thread starter Thread starter mikem
  • Start date Start date
M

mikem

I'm distributing an Excel file with macros. I'd like to
open a dialog box telling users to change the security
option to allow macros to run, but only if their macro
security is set to "high." How do I determine the security
level when the fiel is opened?
 
If it is set to high, then no macros run unless they are certified. If
certified, then you don't need a warning, so I assume you are not certifying
your workbook. Therefore, you will never know if security is set to high
because your macro will not run.
 
all that said, you could hide all but a single sheet in the workbook with
the admonition to set security to medium and allow the macros to run. Then
have code in the thisworkbook event that setups up your workbook normally
and restores it to the single sheet state in the workbook_beforeClose event.
Then, if macros are not run, you workbook has minimal utility and the user
is encouraged to enable macros (sees your message). If they are enabled,
the user may only see your admonition page flash before the workbook is
placed in a working state.
 
Mike

If macros are disabled due to user choice or security settings at "High" you
can allow the workbook to open with a message sheet visible that explains that
macros must be enabled for workbook to function.

For more on this see this google search result.

http://snipurl.com/4ilp

Gord Dibben Excel MVP
 
Mike,

I use the message sheet approach in I explain that tells users that (1) macros
must be enabled for the workbook to function; (2) the Security Level must be
set to Medium using Tools-> Options-> Security-> Macro Security-> Security
Level tab; and (3) 'Trust access to Visual Basic Project' must be checked using
Tools-> Options-> Security-> Macro Security-> Trusted Sources tab

-- Dennis Eisen
 
Back
Top