RE: Disable Macro Warning


Board Regular
Jun 11, 2002
Does anyone know how i can set it so that when a workbook is opened, the warning message doesn't appear...

Plus can this be done in VBA.... as i don't want to lower people security settings.

an in VBA i can disable the warning message then re-enable it....



Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
kind of a Chicken and Egg problem... wouldn't that require opening a workbook with VBA in it, to be open up my workbook ...

any other suggestions...???


Upvote 0

Sorry, I don't think you are going to have any luck with this one. The system is designed to afford some measure of protection against macro-based viruses. It wouldn't be much good if the macro-viruses could switch it off! :wink:

Your only work-around is that suggested by Juan Pablo.
Upvote 0
You can set the macro security settings so that Excel DOES NOT show the macro dialog. To do this, goto TOOLS/MACRO/SECURITY and set the Security Level to LOW. This will allow the loading of workbooks which contain macros, without any dialog prompting. Be careful, since this could allow macro virus' access to your system. But, how often do you say NO when prompted with the macro dialog ? If you are like most people, probably not too often. So you're probably not much worse off with the dialogs disabled. Do you have Norton or some other virus scanning software on your system ? If so, that will help to eliminate macro virus problems even with your security set to LOW. Just beware ...

I'm not sure about setting this via VBA. I could not find anything in the APPLICATION object that seemed to be an obvious choice. It may be there, you'd just have to look a bit harder and/or put another post on the board to see if anyone could help.

Hope this helps.

Upvote 0

I've posted a solution to this a few times, I use it for various applications and I've never had a problem.

Run the Office 2000 setup program again.

On the Select Features screen in the setup program, expand Office Tools.

Select Digital Signature for VBA projects, click the arrow next to your selection, and then select Run from My Computer.

In Windows Explorer, locate and then double-click the file SelfCert.exe in C:Program FilesMicrosoft Office\Office.

Note, Because a digital certificate that you create yourself isn’t issued by a formal certification authority, macro projects that are signed by using such a certificate are referred to as self-signed projects. Depending on how your organization uses the digital-signature features in Microsoft Office, you might be prevented from using such a certificate, and other users might not be able to run self-signed macros for security reasons. Learn about digital signatures.

Once you've digitaly signed your work, the first time you open the file on a users computer, it will ask if the digital certificate is to be trusted. You can tell XL to always trust code signed by this person.

From then on, the user's computer, regardless of security setting, files will open without disable macros prompt.
If there's any reason that this doesn't work, let me know, but from experience around the office and with applications I've sent around the state, its always worked.

Upvote 0
Same problem here. I want to be able to enable/disable the macro in code for only a specific worksheet (Not the whole machine). We already have Firewalls, Norton security, and all on our network to detect the viruses. But, somehow, there has to be a way to enable/disable the macro by worksheet calling from its API.

Cant afford to change to security to LOW since people will forget it to put it back.

Help please.
Upvote 0
Following on what Corticus suggested, go with a Digital Certificate. Your IS Department , with a little research and determination, should be able to get one issued for you.

There is *no way* to programmatically disable the warning. (That would, by its nature, defeat the purpose). Your corporate anti-virus software, I've been assured, will catch anything before Excel gets a chance anyway. The best solution that I've found, in 10+ offices and hundreds of users, is to set Security to LOW myself.


Upvote 0
AutomationSecurity Property:

Returns or sets an MsoAutomationSecurity constant that represents the security mode Microsoft Excel uses when programmatically opening files. This property is automatically set to msoAutomationSecurityLow when the application is started. Therefore, to avoid breaking solutions that rely on the default setting, you should be careful to reset this property to msoAutomationSecurityLow after programmatically opening a file. Also, this property should be set immediately before and after opening a file programmatically to avoid malicious subversion. Read/write.

MsoAutomationSecurity can be one of these MsoAutomationSecurity constants.
msoAutomationSecurityByUI Uses the security setting specified in the Security dialog box.
msoAutomationSecurityForceDisable Disables all macros in all files opened programmatically without showing any security alerts.
msoAutomationSecurityLow Enables all macros. This is the default value when the application is started.

BUT, if anyone can get the example (not attached) working, please let me know because when I try it.. all code stops, including the running code.
Upvote 0

Forum statistics

Latest member

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
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 "".
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