ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Enable Macros by Code (https://www.excelbanter.com/excel-discussion-misc-queries/205502-enable-macros-code.html)

aftamath77

Enable Macros by Code
 
Is there code I can put in visual basic that will enable all macros when the
workbook opens, so there is no need to click the options for enable macros.

I know how to enable macros in the Trust Center, I would like to enable by
code.

Barb Reinhardt

Enable Macros by Code
 
Try putting this BEFORE you open up your macro.

Application.AutomationSecurity = msoAutomationSecurityLow

If you want the user to later be requested to enable macros, change it back
to

Application.AutomationSecurity = msoAutomationSecurityByUI
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"aftamath77" wrote:

Is there code I can put in visual basic that will enable all macros when the
workbook opens, so there is no need to click the options for enable macros.

I know how to enable macros in the Trust Center, I would like to enable by
code.


Richard Schollar[_2_]

Enable Macros by Code
 
Hi

There is no way to include such code within a workbook to enable the macros
within that same workbook - the enable/disbale macros prompt is for security
purposes, so it wouldn't be much use if you could simply override it.

Richard



"aftamath77" wrote in message
...
Is there code I can put in visual basic that will enable all macros when
the
workbook opens, so there is no need to click the options for enable
macros.

I know how to enable macros in the Trust Center, I would like to enable by
code.



Mike H

Enable Macros by Code
 
Hi,

No, you can't enable macros by code. If security is set to medium or higher
then it's a user choice whether macros are enabled or not.

Mike

"aftamath77" wrote:

Is there code I can put in visual basic that will enable all macros when the
workbook opens, so there is no need to click the options for enable macros.

I know how to enable macros in the Trust Center, I would like to enable by
code.


John C[_2_]

Enable Macros by Code
 
Create a Digital Signature.
Add Digital Signature to your macros.
Add Digital Signature to 'Trusted Sources' to the user's computers.

--
John C


"aftamath77" wrote:

Is there code I can put in visual basic that will enable all macros when the
workbook opens, so there is no need to click the options for enable macros.

I know how to enable macros in the Trust Center, I would like to enable by
code.



All times are GMT +1. The time now is 11:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com