Enable or disable macros in Microsoft 365 files (2024)

Excel for Microsoft 365 Word for Microsoft 365 Outlook for Microsoft 365 PowerPoint for Microsoft 365 Access for Microsoft 365 Excel 2021 Word 2021 Outlook 2021 PowerPoint 2021 Access 2021 Visio Professional 2021 Visio Standard 2021 Excel 2019 Word 2019 Outlook 2019 PowerPoint 2019 Access 2019 Visio Professional 2019 Visio Standard 2019 Excel 2016 Word 2016 Outlook 2016 PowerPoint 2016 Access 2016 Visio Professional 2016 Visio Standard 2016 More...Less

Guided support in your browser can provide digital solutions for Office problems

Try guided support

A macro is a series of commands used to automate a repeated task and can be run when you have to perform the task. However, some macros can pose a security risk by introducingviruses or malicious software to your computer.

Warning:Never enable macros in a Microsoft 365file unless you're sure you know what those macros do and you want thefunctionality they provide. You don't need to enable macros to viewor edit the file.For more info seeProtect yourself from macro viruses.

Make a document trusted to enable macros

If you see a security warning when you open a document or try to run a macro, you can choose to make it a trusted document andenable macros. This example is on an Excel workbook.

Enable or disable macros in Microsoft 365 files (1)

  1. Select Enable Content.

  2. In the Security Warning dialog, select Yes to make the document trusted.

    Enable or disable macros in Microsoft 365 files (2)

Macros are now enabled on this document. To revoke a trusted document, you need to clear all trusted documents. For more info, see Trusted documents.

Tip:Rather than enabling macros for each document, you can create a trusted location to store trusted documents.Microsoft 365 will then notcheck them with the Trust Center.For more info, see Add, remove, or change a trusted location in Microsoft Office.

Change macro settings in the Trust Center

Macro settings are located in the Trust Center. However, if your device is managed by yourwork or schoolthe system administrator mightprevent anyone from changing settings.

Important:When you change your macro settings in the Trust Center, they are changed only for the Microsoft 365 app that you are currently using. The macro settings are not changed for all your Microsoft 365 apps.

  1. Select the File tab and chooseOptions.

  2. SelectTrust Center, and then chooseTrust Center Settings.

  3. In the Trust Center, selectMacro Settings.

    Enable or disable macros in Microsoft 365 files (3)

    Tip:If you have the developer tab on your ribbon, select theDevelopertab and then choose Enable or disable macros in Microsoft 365 files (4)Macro Security to open the Trust Center quickly.

  4. Make the selections that you want, then selectOK.

The following are Macro setting options. Not all apps have the same choices.

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 or disable macros in Microsoft 365 files (5)

    Use this setting to enable macros on a case-by-case basis.

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

  • Disable all macros except digitally signed macrosMacros 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 Excelthis 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 Excelthis option is Enable VBA macros (not recommended, potentially dangerous code can run)and it only applies to VBA macros.

  • Excelalso has a checkbox for EnableExcel4.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 modelBlock 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 365program 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 Access hasno Trust access to the VBA project model object option.

See Also

Change macro security settings in Excel

Quick start: Create a macro in Excel.

Block suspicious macros in Office on Windows 10 S.

How malware can infect your PC

Need more help?

Want more options?

Discover Community

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Enable or disable macros in Microsoft 365 files (6)

Microsoft 365 subscription benefits

Enable or disable macros in Microsoft 365 files (7)

Microsoft 365 training

Enable or disable macros in Microsoft 365 files (8)

Microsoft security

Enable or disable macros in Microsoft 365 files (9)

Accessibility center

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Enable or disable macros in Microsoft 365 files (10)

Ask the Microsoft Community

Enable or disable macros in Microsoft 365 files (11)

Microsoft Tech Community

Enable or disable macros in Microsoft 365 files (2024)

References

Top Articles
Latest Posts
Article information

Author: Nathanael Baumbach

Last Updated:

Views: 6426

Rating: 4.4 / 5 (55 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Nathanael Baumbach

Birthday: 1998-12-02

Address: Apt. 829 751 Glover View, West Orlando, IN 22436

Phone: +901025288581

Job: Internal IT Coordinator

Hobby: Gunsmithing, Motor sports, Flying, Skiing, Hooping, Lego building, Ice skating

Introduction: My name is Nathanael Baumbach, I am a fantastic, nice, victorious, brave, healthy, cute, glorious person who loves writing and wants to share my knowledge and understanding with you.