enable macros or application.quit

Qroozn

Well-known Member
Joined
Mar 12, 2002
Messages
543
I remember seeing this code in this site.
it said that if someone clicks disbale macros then quit the application until they click "enable macros"

I'm running office 2000

anyone know where the code is!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

joefederico

New Member
Joined
Sep 17, 2002
Messages
2
There is no code to do this that I know of. To get around this:

1. Create a "dummy" worksheet with the message stating something to the effect of "If this worksheet remains visible you have disbaled macros. For this workbook to function properly you must select enable macros. Close this workbook and re-open enabling macros."

2. Protect the "dummy" worksheet to prevent anyone from altering it.

3. Via VBA, hide every worksheet with the exception of the "dummy" sheet you created earlier. You are best advised to use the xlSheetVeryHidden constant as this prevents the user from unhiding them via the 'Format...Sheet...Unhide' menu item.

4. In your Workbook_Open event procedure unhide all the worksheets then hide the dummy worksheet you created earlier.

5. In your Workbook_BeforeClose event procedure, unhide the "dummy" worksheet you created earlier and xlSheetVeryHidden the rest of the worksheets.

Summary: If the user disables macros the only sheet visible is the protected "dummy" sheet. If the user enables macros, The remainder of the sheets are 1st unhidden and the "dummy" sheet is then hidden. The reverse of this is true upon closing.
 

joefederico

New Member
Joined
Sep 17, 2002
Messages
2
Sorry....it tried to post twice.
This message was edited by joefederico on 2002-09-18 10:10
 

Forum statistics

Threads
1,144,433
Messages
5,724,317
Members
422,543
Latest member
TimB_13

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top