Enable or disable macros in Office files

A macro is a series of commands that you can use to automate a repeated task, and can be run when you have to perform the task. This article has information about the risks involved when you work with macros, and you can learn about how to enable or disable macros in the Trust Center.

Warning: Never enable macros in an Office file unless you're sure what those macros do. Unexpected macros can pose a significant security risk. You don't have to enable macros to see or edit the file; only if you want the functionality provided by the macro.

If you're looking for information on creating macros please see Quick start: Create a macro.

If you're looking for information on using macros on a machine running Windows S see Block suspicious macros in Office on Windows 10 S.

Macros automate frequently used tasks to save time on keystrokes and mouse actions. Many were created by using Visual Basic for Applications (VBA) and are written by software developers. However, some macros can pose a potential security risk. Macros are often used by people with malicious intent to quietly install malware, such as a virus, on your computer or into your organization's network.

Enable macros when the Message Bar appears

When you open a file that has macros, the yellow message bar appears with a shield icon and the Enable Content button. If you know the macro, or macros, are from a reliable source, use the following instructions:

  • On the Message Bar, click Enable Content.
    The file opens and is a trusted document.

The following image is an example of the Message Bar when macros are in the file.

Security Warning Message Bar for macros

Enable macros just for the current session

Use the following instructions to enable macros for the duration that the file is open. When you close the file, and then reopen it, the warning appears again.

  1. Click the File tab.

  2. In the Security Warning area, click Enable Content.

  3. Select Advanced Options.

  4. In the Microsoft Office Security Options dialog box, click Enable content for this session for each macro.

  5. Click OK.

Change macro settings in the Trust Center

Macro settings are located in the Trust Center. However, if you work in an organization, the system administrator might have changed the default settings to prevent anyone from changing settings.

Important: When you change your macro settings in the Trust Center, they are changed only for the Office program that you are currently using. The macro settings are not changed for all your Office programs.

  1. Click the File tab.

  2. Click Options.

  3. Click Trust Center, and then click Trust Center Settings.

  4. In the Trust Center, click Macro Settings.

    macro settings area of trust center

  5. Make the selections that you want, then click OK.

  • Disable all macros without notification     Macros and security alerts about macros are disabled.

  • Disable all macros with notification     Macros are disabled, but security alerts appear if there are macros present. Enable macros on a case-by-case basis.

  • Disable all macros except digitally signed macros     Macros are disabled, but security alerts appear if there are macros present. However, if the macro is digitally signed by a trusted publisher, the macro runs if you have trusted the publisher. If you have not trusted the publisher, you are notified to enable the signed macro and trust the publisher.

  • Enable all macros (not recommended, potentially dangerous code can run)     All macros run without confirmation. This setting makes your computer vulnerable to potentially malicious code.

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

Note: Microsoft Publisher and Microsoft Access have no Trust access to the VBA project model object option.

See Also

Change macro security settings in Excel

How malware can infect your PC

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.

×