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)

FAQs

Enable or disable macros in Microsoft 365 files? ›

Click on Options, then select Trust Center from the list on the left. Click on Trust Center Settings, then go to the Macro Settings section on the left. Ensure that the setting is either set to "Enable all macros (not recommended; potentially dangerous code can run)" or "Disable all macros with notification".

How to enable macros in Microsoft 365? ›

The macro settings are not changed for all your Microsoft 365 apps.
  1. Select the File tab and choose Options.
  2. Select Trust Center, and then choose Trust Center Settings.
  3. In the Trust Center, select Macro Settings. ...
  4. Make the selections that you want, then select OK.

Is enabling macros on a Microsoft Office document safe? ›

Be wary of Microsoft Office documents containing macros. Macros are small bits of programming used to automate tasks that can also be used for spreading viruses and malware. Anti-virus programs cannot always catch all malicious macros.

Does Office 365 disable macros by default? ›

VBA Macro Notification Settings

This policy prevents users from being lured into enabling malicious macros. By default, Office is configured to block files that contain VBA macros and display a Trust Bar with a warning that macros are present and have been disabled.

Why should you not enable all macros? ›

Enable all macros (not recommended, potentially dangerous code can run) Click this option to allow all macros to run. Using this setting makes your computer vulnerable to potentially malicious code and is not recommended.

Where are macros stored in Office 365? ›

Check the Personal Macro Workbook:

It's typically stored in the "XLSTART" folder. The file is called "Personal Macro Workbook" and has an extension ". xlsb." To unhide it, you can go to the "View" tab on the ribbon, click "Unhide" in the "Window" group, and select "PERSONAL.

Why macro is not working in Office 365? ›

Try resetting the macro security settings. To do this, go to File > Options > Trust Center > Trust Center Settings > Macro Settings. Then, select the desired security setting and click OK. If you are still unable to create and run macros after trying the above steps, you can contact Microsoft support for assistance.

Why should you disable macros? ›

Malicious macros can do almost anything that other malware can do to your system, including emulating ransomware, stealing data, and emailing itself out to your contacts.

What are the disadvantages of macros in Microsoft Word? ›

In the macro recording, actions in the user interface will get auto-converted into their respective code. But, these code lines have some unnecessary lines of code. You can not record If and Loop and many other constructs in the macro recording.

Is Microsoft discontinuing VBA? ›

No. Such rumors have been doing the rounds for more than 20 years, but they're not true. There are millions of users relying on VBA, including large businesses and organizations.

Do macros work in Office 365 Online? ›

Although you can't create, run, or edit VBA (Visual Basic for Applications) macros in Excel for the web, you can open and edit a workbook that contains macros. Any existing macros will remain in the workbook, and you can open the workbook in the Excel desktop app to view and edit the macros.

What is the purpose of a macro in Microsoft Office? ›

In Word, you can automate frequently used tasks by creating and running macros. A macro is a series of commands and instructions that you group together as a single command to accomplish a task automatically. To save time on tasks you do often, bundle the steps into a macro. First, you record the macro.

Are macros always disabled by default? ›

Macros are disabled by default because they are created with Visual Basic code that could negatively affect your computer if written or recorded with malicious intent.

Why you should not use macros? ›

Macros reduce code readability

These macros make the code, to say the least, unreadable for someone not used to this specific type of macro. In real projects where multiple people work together this will make teamwork extremely hard.

Why are macros so bad? ›

Biggest issue with macros is that code compiled is not code written. And this also later becomes problem in debugging. Macros are not processed by compiler but preprocessor which is separate tool modifying code before compiler takes it over.

What to use instead of macros? ›

JavaScript: JavaScript is a widely used programming language and can be used in combination with Excel Online to automate tasks and enhance functionality. You can use JavaScript to interact with the Excel Online APIs and perform operations such as reading and writing data, formatting cells, creating charts, and more.

Can you use macros in Office 365 online? ›

Although you can't create, run, or edit VBA (Visual Basic for Applications) macros in Excel for the web, you can open and edit a workbook that contains macros. Any existing macros will remain in the workbook, and you can open the workbook in the Excel desktop app to view and edit the macros.

How do I run a macro in Word 365? ›

Run a macro
  1. Click View > Macros > View Macros.
  2. In the list under Macro name, click the macro you want to run.
  3. Click Run.

How do I enable VBA in Outlook 365? ›

Replies (1) 

You can check your trust center settings by clicking on the File tab and then on the Options button. Then, go to “Trust Center” and “Trust Center Settings”. Then, go to “Macro Settings” and select “Enable all macros” and “Trust access to the VBA project object model”. Click on “o*k” to save the changes.

Top Articles
Latest Posts
Article information

Author: Moshe Kshlerin

Last Updated:

Views: 5630

Rating: 4.7 / 5 (57 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Moshe Kshlerin

Birthday: 1994-01-25

Address: Suite 609 315 Lupita Unions, Ronnieburgh, MI 62697

Phone: +2424755286529

Job: District Education Designer

Hobby: Yoga, Gunsmithing, Singing, 3D printing, Nordic skating, Soapmaking, Juggling

Introduction: My name is Moshe Kshlerin, I am a gleaming, attractive, outstanding, pleasant, delightful, outstanding, famous person who loves writing and wants to share my knowledge and understanding with you.