How to Enable Macros in Excel Safely on Windows 11

Macros can run harmful code, which is why Excel blocks macros in files that came from the internet unless you trust the file. The safest way to allow macros in one workbook is to turn them on for that file only, after you’ve confirmed who made it, and leave Excel’s default macro setting alone.

These steps are for Excel for Microsoft 365 and other current desktop versions of Excel on current versions of Windows 11.

Where did the workbook come from?

Microsoft’s advice is blunt: “Never enable macros in a Microsoft 365 file unless you’re sure you know what those macros do and you want the functionality they provide.” You don’t need macros to open, read or edit a workbook, so the question is only whether you need the automation. Start with the file’s source:

The workbook came from… What to do
You built it yourself on this PC Enable it for that file, or keep your macro workbooks in a trusted location
A coworker, sent through your organization’s file share or OneDrive Confirm with them that the file has macros and what they do, then enable it for that one file
An email attachment or a website download you expected Check with the sender through another channel, then unblock that one file
An unexpected email, a stranger or a site you don’t know Don’t enable macros. Use the workbook without them or delete it

Since a workbook opens and edits fine without its macros, a file that insists you turn them on just to read it deserves suspicion. Ask the sender what the macros do before you go any further.

What Excel blocks, and what each warning means

Microsoft explains on its page about internet macros being blocked by default that VBA macros are a common way for attackers to deploy malware and ransomware, so Office apps on Windows block macros in files from the internet. That change doesn’t affect Office on Mac, Office on Android or iOS, or Office on the web.

In practice you’ll meet one of two messages when a workbook with macros opens:

  • A security warning with an Enable Content button. Excel has disabled the macros under its default setting but lets you decide for this file.
  • A security risk message with no Enable Content button. Microsoft’s wording is “Microsoft has blocked macros from running because the source of the file is untrusted.” This appears for files Windows has marked as coming from the internet, including downloads and email attachments.

On a work or school PC you might instead see “Your administrator has restricted the use of macros in your organization.” That one is a policy, covered next.

Work or school PCs

If your device is managed by your work or school, Microsoft says the administrator might prevent anyone from changing macro settings. Signs can include options you can’t change in the Trust Center or the message that your administrator has restricted macros. There’s no supported way around a policy, and trying one can break your organization’s rules. Ask your IT team; Microsoft’s advice for a blocked location is to upload the file to OneDrive or another location your IT administrator approves and save it there.

Match the route to the message Excel shows

Security warning with Enable Content

When the file is yours or comes from someone you’ve checked with, enable it for that workbook only. Microsoft’s guide to enabling or disabling macros in Microsoft 365 files describes this as making a document trusted:

  1. Open the workbook and look for the security warning below the ribbon.
  2. Select Enable Content.
  3. If a Security Warning dialog asks whether to make the file a trusted document, select Yes.

The macros can now run in that workbook, and Excel treats it as a trusted document. Microsoft notes that to revoke a trusted document, you need to clear all trusted documents, so don’t trust a file you’re only curious about.

Security risk message, no Enable Content

If the file shows the security risk message, Enable Content isn’t offered. Microsoft’s page on a blocked macro gives the steps for a single file you’ve decided to trust:

  1. Close the workbook in Excel.
  2. If it’s an email attachment, save it to your computer first (Microsoft also suggests saving it to OneDrive before opening it).
  3. Open File Explorer and go to the folder where you saved the file.
  4. Right-click the file and choose Properties.
  5. At the bottom of the General tab, select the Unblock checkbox and select OK.
  6. Open the workbook again. If Excel now shows the security warning, select Enable Content.

Unblock one file at a time, and only after the source check above. Microsoft adds that Unblock has no effect if the file sits on a share that Windows treats as the Internet zone; in that case, ask whoever manages that share, or your IT team, before going further.

A folder for your own macro workbooks

If you build macro workbooks regularly, a trusted location saves you from clicking Enable Content every time. Any file saved there is treated as safe, which is exactly why Microsoft says to manage trusted locations carefully and use them sparingly. Only add a folder that holds files you created or checked yourself.

  1. In Excel, select File > Options.
  2. Select Trust Center > Trust Center Settings > Trusted Locations.
  3. Select Add new location.
  4. Select Browse, choose the folder and select OK.

A dedicated folder works better than a busy one: never trust your whole Downloads folder, since anything you download would then run macros without a warning. Microsoft’s page on trusted locations also covers removing or changing one later. Network locations can be trusted, but Microsoft doesn’t recommend it.

The macro setting to leave alone, and the one Microsoft warns about

Excel’s global macro setting lives at File > Options > Trust Center > Trust Center Settings > Macro Settings. If the Developer tab is showing, Developer > Macro Security opens the same page; showing the Developer tab in Excel explains how to add it for recording and running macros.

Spreadsheet app Trust Center on the Macro Settings page with Disable VBA macros with notification selected
(1) Open Macro Settings in the Trust Center, then (2) choose Disable VBA macros with notification. (Illustration)

Microsoft lists these options for Excel:

  • Disable VBA macros without notification: macros don’t run and you aren’t asked.
  • Disable VBA macros with notification: macros are off, and Excel shows the security warning so you can decide per file. This is the setting to keep.
  • Disable VBA macros except digitally signed macros: signed macros from publishers you trust can run.
  • Enable VBA macros (not recommended, potentially dangerous code can run): Microsoft’s own label says why. It isn’t a fix for a blocked file; use the per-file routes above instead.

Microsoft also notes that these settings apply only to Excel, not to other Office programs, so Word and PowerPoint keep their own.

Check the macros run, then tighten things again

  • Check: after Enable Content or Unblock, the warning bar should be gone and the workbook’s buttons or macros should run.
  • Keep the macros when saving: the regular .xlsx format can’t store VBA macro code. Save a workbook with macros as .xlsm, which Microsoft’s list of Excel file formats describes as storing VBA macro code. An .xlsx file, such as one you download from Google Sheets, has no macros to enable.
  • Undo trust: to drop a folder you no longer need, select the folder in Trusted Locations, then Remove and OK; and clear trusted documents in the Trust Center if you trusted a file by mistake.
  • Restore the setting to keep: if someone changed Macro Settings on your PC, set it back to Disable VBA macros with notification.

If a macro locks Excel up, closing it safely is covered in force quitting Excel on Windows and recovering your work.

Macro security questions

How do I stop trusting a workbook I enabled earlier?

Microsoft says revoking one trusted document means clearing all trusted documents. After that, every previously trusted file asks again the next time it opens, which is a reasonable price for removing one you’re unsure about.

Can I trust a publisher instead of a single file?

Yes, when the macros are digitally signed. The Disable VBA macros except digitally signed macros option lets signed macros from publishers you trust run while blocking the rest. Unsigned macros still need one of the per-file routes.

Why isn’t there an Unblock checkbox in Properties?

Microsoft’s blocked-macro page offers other routes when the checkbox is missing: trusting a network share or website, saving an email attachment first, a trusted folder on your PC, or trusting a publisher’s signed macros. On a work or school PC those choices belong to IT, so ask them first.

Next step: decide where the file came from, then use the narrowest route that works, one trusted file before a trusted folder, and never the setting Microsoft labels not recommended.