Skip to main content
← All guides

9 min read

"Microsoft has blocked macros from running" (untrusted source): unblock an Excel file safely

By Quentin Delepierre, Salesforce Commerce Cloud consultant

You open a downloaded workbook and a red banner says "SECURITY RISK Microsoft has blocked macros from running because the source of this file is untrusted.", with no button to enable content. Here's where this block comes from, and how to unblock a file you're sure about — without lowering your guard for all the others.

Need to edit an XML file in Excel? Generate a ready-to-use workbook:

Generate my workbook

Free account, 3 free credits, no credit card.

How do you unblock a file you trust?

For Windows, with a file whose origin you know. No "Unblock" checkbox, or the message comes back: see "Still blocked?" just below. Either way, don't lower Excel's security settings.

  1. Close the workbook, then right-click the file in File Explorer and choose Properties.
  2. At the bottom of the General tab, tick "Unblock", then click OK.
  3. Reopen the workbook; if the yellow "Enable Content" bar appears, click it.

Still blocked? Which case is yours?

  • No "Unblock" checkbox, on a Mac: this block doesn't apply on Mac, so there's nothing to unblock. See "What about Mac?".
  • No "Unblock" checkbox, OneDrive or SharePoint file: a file opened with "Open in Desktop App", or synced by the OneDrive app, doesn't carry the Mark of the Web. If it's still blocked, the cause is elsewhere: see the messages below.
  • No "Unblock" checkbox, file on a network share or workbook from a ZIP: see "Special cases".
  • "Unblock" already ticked, still blocked: Microsoft states that unblocking is enough as long as no policy and no macro setting blocks macros. See the messages below.
  • "Because of your security settings, macros have been disabled": this isn't the Mark of the Web, it's Excel's macro setting (File › Options › Trust Center › Trust Center Settings › Macro Settings). With the default setting, "Disable VBA macros with notification", reopen the workbook and click "Enable Content" if you're sure about the file. With a stricter setting, don't change it for one file: put that file in a trusted location reserved for it (never your Downloads folder), and only keep files you trust there.
  • "The macros in this project are disabled" (when you run a macro): macros are turned off for this workbook. Same steps as for the previous message.
  • "Macros in this document have been disabled by your enterprise administrator for security reasons", or greyed-out macro options: that's a rule set by your organization, through Group Policy or a similar tool. See "At work" and the two sections after it.

Where does this message come from?

VBA macros are a common way to spread malware. Since 2022, Excel therefore blocks macros by default in files that come from the Internet: email attachments, browser downloads… Windows adds a "Mark of the Web" to these files, and Excel refuses to run their macros.

This block only affects Excel on Windows: Microsoft states that it doesn't apply on Mac, on iPad or to Excel for the web. On Mac, Excel simply asks at every opening whether you want to enable macros (see below).

Which banner do you see?

  • "PROTECTED VIEW", with an "Enable Editing" button: the file comes from the Internet and opens read-only. Click "Enable Editing"; if the red banner then shows up, follow the steps below.
  • Red "SECURITY RISK" banner, with no button: that's the block on macros in files from the Internet. It goes away once you unblock the file, as explained below.
  • Yellow "SECURITY WARNING Macros have been disabled" bar, with an "Enable Content" button: click it if you're sure about the file. Excel remembers it for that file, as long as you don't move it.
  • "Your administrator has restricted the use of macros in your organization": that's a rule set by your company (see "At work").
  • "Because of your security settings, macros have been disabled" or "Macros in this document have been disabled by your enterprise administrator for security reasons": macros are turned off by the macro setting or by a rule of your organization (see "Still blocked?" above).

Before unblocking: are you sure where it comes from?

  • You were expecting this file and know where it comes from — for instance a workbook you've just generated yourself on a site you trust: you can unblock it.
  • Unexpected attachment, "urgent" invoice, unknown sender: don't unblock, delete the file.
  • If in doubt, ask your IT department.

Unblock one specific file (Windows)

  1. Close the workbook in Excel.
  2. In File Explorer, right-click the file, then choose Properties (or select the file and press Alt+Enter).
  3. At the bottom of the General tab, under "This file came from another computer…", tick the "Unblock" checkbox, then click OK.
  4. Reopen the workbook. If Excel shows the yellow "Enable Content" bar, click it.

Special cases

  • The file is inside a ZIP: unblock the .zip file before extracting it, as files extracted with Windows File Explorer inherit the Mark of the Web. And don't open the workbook straight from inside the ZIP: extract it first.
  • There's no "Unblock" checkbox: if the file is on a network share, Windows may treat it as coming from the Internet without offering to unblock it. Copy it to a folder on your computer and open the copy. If the checkbox is also missing for a file on your computer, your organization has hidden it: it's up to your IT department.
  • OneDrive, SharePoint or Teams files: a file opened with "Open in Desktop App", or synced by the OneDrive app, doesn't carry the Mark of the Web; a file downloaded with the browser does. And Excel for the web doesn't run any macro anyway.
  • You prefer the command line: in PowerShell, Unblock-File -Path "C:\Users\you\Downloads\workbook.xlsm" does the same as the "Unblock" checkbox.
  • Nothing works: your organization may have forbidden macros. It's then up to your IT department to decide.

What about Mac?

Excel for Mac doesn't apply this block. Every time you open a workbook that contains macros, it asks "Do you want to disable macros before opening the file?": click "Enable Macros" if you're sure about the file.

No question when opening? Excel is set to disable macros without warning (Excel › Preferences (or Settings) › Security); the default setting does ask. If the option is greyed out, your organization manages it. Either way, don't change this setting for one file. If it's an ExcelifyXML workbook, save it and drop it on the Rebuild page instead (see below).

What not to do

  • Don't lower the macro setting in the Trust Center: the most permissive option, which Microsoft marks "not recommended", would let any file run its macros, not just this one.
  • Don't add your Downloads folder to the trusted locations: any file landing there could run its macros unchecked.
  • Don't bulk-unblock a whole folder of downloaded files: only unblock the file whose origin you know.

At work

Your organization may have tightened these rules. The security settings Microsoft recommends to companies, for instance, only allow digitally signed macros, with no message at all for the others. Unblocking the file is then not enough, and it's up to your IT department: they can review the macro's code, define a trusted location reserved for certain files, or trust the publisher of a signed macro. Microsoft recommends granting such exceptions sparingly.

No button, or "Unblock" does nothing: your organization has disabled macros

If the banner offers no button, if the "Unblock" checkbox changes nothing while no case from "Still blocked?" applies, or if Excel shows "Your administrator has restricted the use of macros in your organization" (Microsoft's message), the file is no longer the problem: a rule set by your organization applies, and it takes precedence over your choice.

"Macros in this document have been disabled by your enterprise administrator for security reasons" says the same thing: Microsoft links it to the "Block macros from running in Office files from the Internet" policy. No button lets you override it. If the macro options in the Trust Center are greyed out, that's also a rule from your organization. The messages "Because of your security settings, macros have been disabled" and "The macros in this project are disabled" come first from the macro setting: see "Still blocked?" at the top of the page.

These rules are set by your IT department through Group Policy, Cloud Policy or Intune, on Microsoft 365 Apps for enterprise. Microsoft mentions in particular:

  • "Block macros from running in Office files from the Internet": when enabled, it blocks macros in files from the Internet, and the "Unblock" checkbox no longer helps. Microsoft recommends it in its security baseline.
  • "Macro Notification Settings" (VBA in Excel), set to "Disable all without notification": macros are switched off with no message or button. Set to "Disable all except digitally signed macros", only macros signed by a trusted publisher run.
  • Trusted locations and trusted publishers defined by the organization: a file that isn't in one doesn't run.

What to do when it's an organization rule

Don't try to get around the rule: don't edit the registry or the policies, don't move the file to a trusted folder on your own, don't take it to a personal device to open it. These rules protect your organization, and bypassing them may break its IT policy. The legitimate route goes through your IT department:

  1. Write to IT: file name, where it comes from, what its macro does, and the message you see (a screenshot helps).
  2. Ask for, depending on their policy, a trusted location for this file or, if the macro is digitally signed, trust in its publisher. Microsoft recommends that administrators manage trusted publishers themselves and grant such exceptions sparingly: a refusal is possible.
  3. If the exception is refused or slow, use the no-macro route (below): it doesn't need any macro to run on your computer.

The no-macro route with ExcelifyXML

If you're editing an XML file in Excel, the macro isn't essential. Drop the XML on the Upload page (the preview is free before any charge) and get an Excel file back; edit it like any table; then drop the saved file on the Rebuild page: the site reads the data and regenerates the XML online, without running any macro. That Excel file holds no macro to unblock.

What about ExcelifyXML workbooks?

Our standalone Excel workbooks contain a macro that does one thing only: read the data sheet and write the XML file where you choose, with no network connection and no automatic start. Its full code is published. It isn't digitally signed yet: if your organization only allows signed macros, or if the macro stays blocked, save the workbook after your edits and drop it as is on the Rebuild page. The site reads its data sheet, without running the macro, and rebuilds the XML online. The standard bundle included in every generation works too; an older workbook, which doesn't hold its structure yet, is dropped with that bundle's skeleton.json ("Separate files").

Need to edit an XML file in Excel? Generate a ready-to-use workbook:

Generate my workbook