Is It posible to Show if Macros have been enabled?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
HI Everyone,

So I have a sheet that requires macros to be enabled to use.

I have created a front sheet Called Macros that shows when the user opens the document.

If Macros are enabled a macro will run that hide this sheet and goes to the strat page, if they are not enabled they get the warning page.

however I was woulder if there was a way to get it to either show then when they have switch macros on or auto run a macro called "Start1" as soon as macros are enabled?

Thanks

Tony
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I'm subscribing to this thread because the way you've done it is the only way I've managed to think of, and I'd love to know a better way. I suspect the only other way of knowing whether macros are enabled is by running a bit of VBA...
 
Upvote 0
Am I getting the right end of the stick here: - If I have a Workbooks_Open macro it runs as soon as the user enables macros.
 
Upvote 0
If you have a workbook_open routine, it will run when the workbook is opened if Macros are enabled. I don't think it will run if the application and workbook are opened with macros disabled, and then macros are enabled after the open event is finished.
 
Upvote 0
If you have code in the Open event that hides the splash screen, then seeing the splash screen tells users implicitly (and should do so explicitly) that macros are not enabled, and need to be for the workbook to operate. If they don't see the splash screen, then macros are enabled.

That requires code to hide all but the splash screen worksheet each time the workbook is saved, and then restores the environment after the save. The forum has many examples.
 
Last edited:
Upvote 0
If you have a workbook_open routine, it will run when the workbook is opened if Macros are enabled. I don't think it will run if the application and workbook are opened with macros disabled, and then macros are enabled after the open event is finished.

I have tried a WB Open event, which just calls a macro in a module that puts up a msg box to say 'macro x called'.
When I open the WB nothing occurs. A minute later as soon as I hit the enable macros button the message box pops up.

That suggests the event isn't fired until macros are enabled????
 
Last edited:
Upvote 0
It sure does :) . I had never had occasion to try it, and wasn't in a spot to test it out yesterday...I was making an educated guess based on the fact that the WB is already "open" by the time you enable. I stand corrected. That's a good thing in this case...when and if the user does enable macros, then the splash screen goes away and all is well.
 
Upvote 0
So back to Tony to try.....
Put this in 'ThisWorkbook' of the VBA project

Code:
Private Sub Workbook_Open()

Call Start1

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

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