ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determining if Macro Can Run (https://www.excelbanter.com/excel-programming/291413-determining-if-macro-can-run.html)

mikem

Determining if Macro Can Run
 
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?

Tom Ogilvy

Determining if Macro Can Run
 
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.

--
Regards,
Tom Ogilvy

"mikem" wrote in message
...
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?




Tom Ogilvy

Determining if Macro Can 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.

--
Regards,
Tom Ogilvy

"mikem" wrote in message
...
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?




Gord Dibben

Determining if Macro Can Run
 
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

On Sun, 15 Feb 2004 09:51:55 -0800, "mikem" wrote:

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?



DennisE

Determining if Macro Can Run
 
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


All times are GMT +1. The time now is 10:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com