Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable the "enable Macro" through code

Status
Not open for further replies.

Mack2

Instructor
Mar 12, 2003
336
US
I need to through vba disable the enable / disable dialog box in excel. I want the dialog box to come up, I just want to some how open the workbook using another workbook, but when asked to disable/enable macros, I want the code to disable macros.
I ran the recorder and opened up the workbook from a different workbook, but the recorder did not add code for setting the disable macro = true.
This is a strange request...thanks!
 
You can't use Code to change that setting, because the setting must be set to true before code can run.

If you could just write code to bypass it, malicious folks would use it as a way to sneak malware onto your computer. There wouldn't be any need to ask if you could just bypass it with code, would there?

But if you set Tools > Macro > Security to high, all code will be disabled without any warning message being shown.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
What about this ?
Application.AutomationSecurity = msoAutomationSecurityForceDisable

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Update to previous post:
Signed code will be enabled under high security if the certificate is one of the Trusted Sources.
 
We will be sending the spreadsheet to customers. So I can not be sure what security level they will have set. That is why I am looking for a way through vba to disable the message.
I tryed the code below, and the message still came up.
Application.AutomationSecurity = soAutomationSecurityForceDisable
 
I understand your frustration, but you want to use code to disable code from running - but that code can only be launched once a user has enabled code. It's circular logic-ish.

What I'd suggest is having your macro copy relevant data/sheets/charts to a new workbook - one that doesn't contain any code - and emailing that file to your customers.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top