How Do I Enable All Macros

TotallyConfused

Board Regular
Joined
May 4, 2017
Messages
247
Office Version
  1. 365
Platform
  1. Windows
Hello

I have a series of programs I've written and each one contains one or more VBA macros. Normally for protection, Excel is set NOT to allow any macros, but now I need to change those settings temporarily. My thinking is that I’d disable the setting not allowing any macros, at the beginning of each program, then reset them at the program’s end. The computer is able to go online; however, all of the programs are on its hard drive. We’re not accessing any websites or anything, so I’d think we’d be safe enough.

My idea may be good; however, being a relative newcomer to Excel/VBA, I know my programming skills are not so good. I’ve learned how to manually disable that security setting by ‘Alt L’ then typing ‘A S’, which causes a ‘Trust Center’ screen to pop up, allowing me to select one of four options. I’d prefer not to make the user go through that process. The following macro seems to accept the ‘Alt L’ part, at least I think it is, but then it stops and won’t accept anything else.

Code:
Sub EnableAllMacros()
      SendKeys "%{L}", True
           ‘ At this point, everything comes to a halt.
End Sub

I’ve tried various combinations of that single line of code, ranging from combining everything in one line, to several lines of SendKeys. If anyone has any suggestions on how I can temporarily disable that safety restriction I’d sure love to hear them?

It’s my understanding that once I’m able to access that ‘pop-up’ screen, then I need to switch to Ctrl (which is ‘^’) ‘then the underlined letter’. Is this correct? Perhaps there is a better way to over-ride that restriction then the way I’m attempting, if so, I’d appreciate hearing it.

THANK YOU in advance for any help you may be able to offer.

TotallyConfused
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
I don't believe this is a setting you can change, I think you have to manually enable/disable macros
 
Upvote 0
If you are opening an excel file programmtically, macros are enabled by default. So after you open first file and start running its code, there should be no need to enable macros for macro files opened by that code.

That said, you can use Application.AutomationSecurity property to change the macro security mode used when opening files through code. More info on that here.
 
Upvote 0
If you are opening an excel file programmtically, macros are enabled by default. So after you open first file and start running its code, there should be no need to enable macros for macro files opened by that code.

That said, you can use Application.AutomationSecurity property to change the macro security mode used when opening files through code. More info on that here.

Hello once again

THANK YOU for your reply. This question applied also to the situation I described in my other question, 'How Do I Suppress the Update Message' that you also answered. All the programs except that one, the MENU program are opened by that MENU program, so according to your answer I have nothing to worry about.

I've taken a quick look at the link you provided and thanks for that too. There is a world of information in that site. It'll take me a while to fully check it out. Again thanks a lot.

TotallyConfused
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,164
Members
453,021
Latest member
Justyna P

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