Test for Disable / Enable Macros

N

Neal Zimm

I'm building an App where code in the Wbk Open event must execute.
I can't find where/how to test if the user has clicked the disable macro
button when Excel presents that choice. (Note: I have a "gateway" Sub in the
works that will execute before every user-selected macro to be the likely
home for this code.)

Further note: the open event calls a macro located in an add-in.

1) example please or point me in the right direction?

2) I know the 'danger', but does Exel allow you to disable the dis/enable
dialog box in favor of forcing "Enable Macros". and if so, how?

Thanks much,
Neal Z
 
J

Jim Thomlinson

There is no effective way to circumvent the Macro Security. The problem you
are going to run into is that if the macros are disabled then NO code runs
and you can not use code to check anything. The most effective work around is
to ensure that all of the sheets are very hidden (done with befroe close
code) with the exception of a security sheet that tells the user that macros
must be enabled to use the book. If macros are enabled then use code to
unhide the appropriate sheets and hide the security page.
 
H

Halim

Hi,

I think Jim was right but I've tried by using registry file or changing
Excel's security via *.reg that opened before execute Excel file.

You can change the security you like... but ensure that registry contents
correct Address of setting you want to change (Excel Security), that depend
on you Excel version... ...
 
N

NickHK

If I found your code attempting to change my security setting, I would
instantly delete all your products.
If you cannot operate within the user's environment, inform the user of the
limitation/situation and exit.
Unless of course you wish to get a name as a virus writer.

NickHK
 
N

Neal Zimm

Thanks, i have very hidden sheets already and will try to incorporate what i
need into them.
 
H

Halim

Sorry Nick...

I'm not attempting to harm other people application, I only try to share...
:D
 
N

Neal Zimm

Thanks, kinda new @ this and didn't that of that aspect. Very sensible.
Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top