Closing a Workbook if Macros aren't enabled.

S

SlyMaelstrom

Basically, I want to make my workbook such that either you enable the
macros or it closes the workbook. That means when the prompt comes up
regarding macros, if you choose to disable them it will close the
workbook. Obviously, this can't be done with a macro because the user
has disabled them... so does anyone know a way? The reasoning for this
is that my macros are designed to ensure the user fills in certain
fields and they do it correctly. I'm doing this with macros as I don't
believe Excel offers a method of requiring a cell to be filled in
without them. Any help with this would be great.

-- Bill
 
G

Guest

Set up a dialogbox or small form confirming the desire of the user to enable
macros, when your macro really is doing is exiting/closing the workbook if
the user clicks on No or if the user clicks on cancel. You set this tricky
little form on Open and it should provide you with the same results as if you
were enabling macros.
Regards,

Michael Arch.
Please click on yes or no if the positng was helpful
 
I

ilia

Here's what I've seen done before.

Set up a worksheet that explains to the user that macros need to be
enabled, and how to enable them. Make all other sheets xlVeryHidden.
Password your VBA project so that users cannot change this property.
They won't be able to do it from the Immediate window either, if
macros are disabled.

In your Workbook_Open code, call a procedure to unhide the data entry
sheets, and hide the "enable your macros" sheet. This will only occur
if macros are enabled. Likewise, insert code to re-hide them in your
Workbook_Close event.

This way, while the workbook won't close by itself with macros
disabled, it will not allow the user to perform data entry either.
Instead, it will instruct the user to close and reopen the workbook,
and enable macros. If the user screws it up again, this process
repeats.

If the user does enable macros, the Workbook_Open code will setup the
workbook for proper data entry, with all your macros operating as
intended.

Hope this helps your situation.
 
S

SlyMaelstrom

Here's what I've seen done before.

Set up a worksheet that explains to the user that macros need to be
enabled, and how to enable them. Make all other sheets xlVeryHidden.
Password your VBA project so that users cannot change this property.
They won't be able to do it from the Immediate window either, if
macros are disabled.

In your Workbook_Open code, call a procedure to unhide the data entry
sheets, and hide the "enable your macros" sheet. This will only occur
if macros are enabled. Likewise, insert code to re-hide them in your
Workbook_Close event.

This way, while the workbook won't close by itself with macros
disabled, it will not allow the user to perform data entry either.
Instead, it will instruct the user to close and reopen the workbook,
and enable macros. If the user screws it up again, this process
repeats.

If the user does enable macros, the Workbook_Open code will setup the
workbook for proper data entry, with all your macros operating as
intended.

Hope this helps your situation.






- Show quoted text -

That's smart. I'll do that.

Michael, I don't get your post... how could I get to what you're
saying if Macros are disabled?
 

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