Enable or disable macros in Microsoft 365 files

Enable or disable macros in Microsoft 365 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. Macros automate frequently used tasks to save time on keystrokes and mouse actions.

However, some macros can pose a 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.

Warning: Never enable macros in a Microsoft 365 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. For more information see Protect yourself from macro viruses.

Change macro settings in the Trust Center

Macro settings are located in the Trust Center. However, if your device is managed by your work or school the system administrator might prevent anyone from changing settings.

Important: When you change your macro settings in the Trust Center, they are changed only for the Microsoft 365 program that you are currently using. The macro settings are not changed for all your Microsoft 365 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.

Note: The options are slightly different in Excel, we'll call those out as we go.

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

    In Excel this option is Disable VBA macros without notification and it only applies to VBA macros.

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

    In Excel this option is Disable VBA macros with notification and it only applies to VBA macros.

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

    In Excel this option is Disable VBA macros except digitally signed macros and it only applies to VBA macros.

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

    In Excel this option is Enable VBA macros (not recommended, potentially dangerous code can run) and it only applies to VBA macros.

  • Excel also has a checkbox for Enable Excel 4.0 macros when VBA macros are enabled. If you select this checkbox all of the above settings for VBA macros will also apply to Excel 4.0 (XLM) macros.

    If this checkbox is not selected XLM macros are disabled without notification.

  • 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 a Microsoft 365 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.


    • Related Articles

    • Microsoft OneDrive - Sharing Basics

      The files on your OneDrive are private until you share them. Keep in mind that when you share folders with Edit permissions, people you share with can add the shared folders to their own OneDrive. This lets them keep the folder alongside their own ...
    • How To Enable Macros in Excel

      Please read this article on how to enable macros on Excel spreadsheets: How to Enable Macros in Microsoft Excel: 7 Steps (with Pictures) (wikihow.com) If you are interested in learning more on this subject, please read this ...
    • Add, remove, or change a trusted location in Microsoft Office

      A trusted location in Microsoft Office is a folder that contains files you trust to be safe. You should use a trusted location to store a file when you don't want that file to be checked by the Trust Center, or if you don't want it to open in ...
    • Set up devices for Microsoft 365

      Please refer to this link to the Microsoft support page for information on setting up your mobile device to access McKibbon O365 resources (specifically Outlook emails). These instructions should also be followed for any brand accounts that are using ...
    • Microsoft 365 Apps activation error: “Sorry, another account from your organization is already signed in on this computer”

      Try these instructions to remove the account and add it back to the device in question https://learn.microsoft.com/en-us/office/troubleshoot/activation/another-account-already-signed-in