Aller au contenu
tricknfixGAMING · TECHNOLOGIE · INFORMATIQUE
Créer
Share
Share this topic

PC CONFORT · ENGLISH VERSION

"Microsoft has blocked macros from running" in Office: cause and solutions

English translation of the original French post. Code, commands, paths and error codes keep their original meaning. Replies and moderation are shared in the original discussion.

You open an Excel, Word or PowerPoint file received by email or downloaded, and a red security risk banner says: "Microsoft has blocked macros from running because the source of this file is untrusted". This is not a fault: since 2022, Office on Windows blocks VBA macros in files from the Internet by default, because they are often used to install malware. The Enable Content button therefore no longer appears for these files.

Problem

  • Banner "Microsoft has blocked macros from running because the source of this file is untrusted".
  • Buttons or automations in a workbook no longer do anything.
  • The same file works on another PC, or worked before it was sent by email.
  • Message "Your administrator has restricted the use of macros in your organization".
  • File opened from a network share by its IP address: macros blocked too.

First of all: should this file really contain macros?

Microsoft makes the point: reading or editing a document does not require macros. If you were not expecting this file, or if a stranger or a message pushes you to "enable content" (order cancellation, invoice, legal document), do not unblock anything and delete the file. The steps below only apply to files whose origin and purpose you know.

Observe before acting

The block relies on the Mark of the Web: Windows adds zone information to the downloaded file. To read it, open Command Prompt in the file's folder and type (replace the name):

Batch3 lines

notepad classeur.xlsm:Zone.Identifier

Notepad shows a ZoneId line under [ZoneTransfer]. According to Microsoft: 0 = My Computer, 1 = Local intranet, 2 = Trusted sites, 3 = Internet, 4 = Restricted sites. With ZoneId=3, macros are blocked by default; with 2, they are not. If Notepad finds nothing, the file does not carry this mark.

What you seeMost likely causeStep
ZoneId=3, file downloaded or received by emailMark of the WebStep 1
File on a network share or internal site, no Unblock checkboxLocation classified in the Internet zoneStep 2
Many trusted files in the same local folderFolder not trustedStep 3
File on OneDrive or SharePointFile downloaded instead of opened in the appStep 4
"Your administrator has restricted the use of macros"Company policyStep 5

Step 1: unblock a single file

When to use it: a trusted file downloaded or received as an attachment.

Suggested solution

  1. Close the file in Office.
  2. If it comes from an email, save it to the disk (or to OneDrive) first.
  3. In File Explorer, right-click the file > Properties.
  4. At the bottom of the General tab, tick Unblock, then OK.
  5. Reopen the file.

PowerShell equivalent, which does the same thing as the checkbox according to Microsoft:

PowerShell3 lines

Unblock-File -Path "C:\Users\nom\Documents\classeur.xlsm"

Expected result: the red banner disappears; depending on your Office settings, a yellow bar may still ask you to enable content.

Rollback: there is no checkbox to put the mark back; delete the unblocked copy and download the original file again if you change your mind.

Step 2: files on a network share or internal site

When to use it: the Unblock checkbox is missing, or ticking it changes nothing, for files opened on a file server or an internal site.

Microsoft explains that if the share is considered to be in the Internet zone (for example when it is opened by its IP address, like \\192.168.1.10\partage), the Unblock checkbox has no effect.

Suggested solution

  1. Open the Start menu, type Internet Options and open it.
  2. Security tab > Trusted sites > Sites.
  3. Enter the address of the server or site (full name or IP address), then Add. For an http:// address or a network share, clear Require server verification (https:) for all sites in this zone.
  4. Close, then OK, and reopen the file.

Expected result: macros in files from this location are no longer blocked by the Mark of the Web.

Rollback: same window, select the address and Remove.

Warning: Microsoft cautions that you will then trust all macros from this location, and that the site also gets elevated permissions outside Office. Only do this if you control who can save files there.

Step 3: trust a local folder

When to use it: you regularly work with trusted macro-enabled files stored in the same folder on your PC.

Suggested solution

  1. In Excel, Word or PowerPoint: File > Options > Trust Center > Trust Center Settings > Trusted Locations.
  2. Add new location, then Browse to choose the folder, and OK.
  3. Only save files you are sure about in this folder.

Expected result: files opened from this folder run their macros without the banner.

Rollback: same screen, select the location and Remove.

Do not trust a catch-all folder such as Downloads or the Desktop.

Step 4: files on OneDrive or SharePoint

When to use it: the file is stored on OneDrive, SharePoint or in the files of a Teams channel.

Suggested solution

  1. Open the file with the Open in Desktop App option instead of downloading it.
  2. If you downloaded it, unblock the local copy (Step 1).

Expected result: the file opened directly from OneDrive or SharePoint no longer shows the Mark of the Web banner.

Rollback: none.

Step 5: block enforced by your company

When to use it: the message mentions your administrator, or the options above are greyed out.

Suggested solution

On a work PC, macros can be blocked by an organization policy, which you must not bypass. Microsoft advises saving the file to OneDrive or another location approved by your IT department, then reopening it. Otherwise, contact your IT department: it can approve a location or a publisher of signed macros.

Expected result: the file works from the location approved by your company.

Rollback: none.

What not to do

  • Choose Enable all macros in the macro settings: this removes the protection for every file.
  • Add the whole C: drive or the Downloads folder as a trusted location.
  • Unblock a file just because its content asks you to.

Final check

  • ☐ The origin of the file is known and expected.
  • ☐ notepad fichier:Zone.Identifier no longer finds ZoneId=3 (unblocked local file).
  • ☐ The red banner is gone when the file is reopened.
  • ☐ Added trusted locations are limited to folders or servers you control.

Sources

For PowerShell scripts blocked for the same reason, see "Running scripts is disabled on this system" in PowerShell.

Still having the problem?

Reply to this topic with the app and its version (File > Account > About), where the file comes from (email, website, network share, OneDrive), the ZoneId value shown and the exact text of the banner. Do not attach the file, and remove server or user names.

Continue the discussion

The replies are available in the original French thread. They have not been translated.

Read the discussion