This article contains information about the risks involved when using macros, and you can learn how to enable or disable macros in Excel.
If you open a workbook containing a macro, you will see a yellow bar message SECURITY WARNING Macros have been disabled at the bottom of the ribbon.
If you click X to close this message, you can't run macros of this workbook. If you run a macro of this workbook, Excel will display another warning message:
Because of your security settings, macros have been disabled. To run macros, you need to reopen this workbook, and then choose to enable macros. For more information about enabling macros, click Help.
If you click Enable Content, it will automatically become a trusted document. This means that as soon as you open the file on your computer, you will no longer be prompted to enable the content. The basic idea is that if you tell Excel that you "trust" a particular workbook by enabling macros, then you will probably enable macros every time you open it. As a result, Excel remembers that you have previously enabled macros and disables any further messages about macros for that workbook.
If you open a workbook download from internet, you will see a yellow bar message:
at the bottom of the ribbon.
If you’re sure the file is safe and want to edit it, please chick Enable Editing.
If you open a macro-enabled workbook download from internet, you will see a red bar message:
If you’re sure the file is safe and want to unblock macros, there are a few different ways to do it, depending on your situation.
Unblock a single file
In most cases you can unblock macros by modifying the properties of the file as follows:
- Open Windows File Explorer and go to the folder where you saved the file.
- Right-click the file and choose Properties from the context menu.
- At the bottom of the General tab, select the Unblock checkbox and select OK.
Unblock all files from a specific network share or website
If you often download files or directly open files from a trusted cloud location, such as your company’s website or an internal file server, you can set the site as a trusted site in Windows so macros from the site won’t be checked.
You’ll trust all the macros from this site if you choose to apply this setting, so only do this if you know that every file opened from this location is trustworthy.
- Tap the start button or Windows key and select Settings.
- In Settings window, type Internet Options.
- Select Internet Options from the search results and the Internet Properties dialog box will appear.
- On the Security tab, select Trusted Sites, then select Sites.
- Type the URL of the site or server that contains the Excel files with the macros you want to run (E.g. type
excelbaby.com), and then select Add.
If you want to add URLs that begin with http:// or network shares, uncheck Require server verification (https:) for all sites in this zone.
- Select Close and then OK.
If you're comfortable that the source of the macros is a person or company that you know you can add them as a trusted publisher to unblock this macro and any future macros the publisher signs with the same certificate.
First, you'll need to unblock this particular file using the steps above, Then, you can add the publisher as a trusted publisher so that future macros will run seamlessly.
- Open the file from the new publisher.
- Select the File tab.
- In the Security Warning area, click Enable Content > Advanced Options.
- In Microsoft Office Security Options, click Trust all documents from this publisher.
If you don't want any macro warning messages to upset you, you can set a trusted location for your macro files. A trusted location is a directory that is considered a secure area and holds only trusted workbooks. A trusted location allows you to run a macro-enabled workbook without security restrictions, as long as the workbook is located in that location.
To set up a trusted location, do the following steps.
- On the Developer tab, click the Macro Security button in the Code group to launch the “Trust Center” dialog box.
- In the Trust Center dialog, select the Trusted Locations item in the left-hand panel.
- Now, click the Add new location button to open the “Microsoft Office Trusted Location” dialog.
- Click Browse to find and specify the directory that will be considered a trusted location.
- Click the OK button to see your selected folder added to the list of Trusted Locations in the Trust Center.
Macro Security Settings
On the Developer tab, click the Macro Security button in the Code group to launch the “Trust Center” dialog box.
In the Trust Center dialog, select the Macro Setting item in the left-hand panel.
Disable VBA Macros Without Notification
This setting prevents all macros and security alerts about macros from running. This setting is roughly equivalent to the old Very High security setting in Excel 2003. With this setting, only macros in the Trusted Locations folders can run.
Disable VBA Macros With Notification
This means that you see a notification when you open a file with macros, and you can choose to enable the content. If you ignore the notification, the macros remain disabled. This setting is similar to the Medium security setting in Excel 2003 and is the recommended setting.
Disable VBA Macros Except Digitally Signed Macros
Macros are disabled, and security alerts appear if there are unsigned macros present. However, if the macro is digitally signed by a trusted publisher, the macro just runs. If the macro is signed by a publisher you haven't trusted yet, you are given the opportunity to enable the signed macro and trust the publisher.
Enable VBA Macros (Not Recommended: Potentially Dangerous Code Can Run)
All macros run without confirmation. This setting is similar to the Low macro security setting in Excel 2003. Although it requires the least amount of hassle, it also opens your computer to attacks from malicious Melissa-like viruses. Microsoft suggests that you not use this setting.
Trust access to the VBA project object model
Disallow or allow programmatic access to the Visual Basic for Applications (VBA) object model from an automation client. This security option is for code written to automate an Office program and manipulate the VBA environment and object model. It is a per-user and per-application setting, and denies access by default, hindering unauthorized programs from building harmful self-replicating code. For automation clients to access the VBA object model, the user running the code must grant access. To turn on access, select the check box.