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

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
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.
 
Upvote 0

Forum statistics

Threads
1,214,631
Messages
6,120,645
Members
448,974
Latest member
DumbFinanceBro

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
Back
Top