"Microsoft has blocked macros from running because the source of this file is untrusted"
A red banner blocks the macros in a file that came from the internet, an email or a network share. This is deliberate behaviour introduced in 2022, not a fault, and the correct fix is to establish trust in the source rather than to disable the block.
What you see
Opening a .xlsm, .docm or .accdb shows a red banner reading "Microsoft has blocked macros from running because the source of this file is untrusted", with a Learn More button and no Enable Content option. The same file runs correctly for a colleague, or ran correctly before it was emailed.
What is actually wrong
Windows tags files that arrive from outside the machine with a Mark of the Web — an alternate data stream named Zone.Identifier recording the zone they came from. Since 2022 Office refuses to run VBA in any file carrying that tag from the internet zone. Because the tag travels with the file, one download or one copy from a share applies it to every copy made afterwards.
Codes and articles
Start here — find out which fix applies
A script that runs the 1 inspection command from the write-up below and prints what each one returned. It reads the machine and changes nothing — every command that could write, delete, start or stop is excluded from it by construction. Run this first, then pick the fix its output points at.
Fixes (3)
Unblock a single file you have verified
One file, from a sender you have confirmed by some means other than the email itself.
Stop and confirm the file is what it claims to be. This block exists because macro-enabled attachments are the most common delivery route for ransomware, and the banner is the last thing standing between a convincing email and code execution. Verify the sender by phone or in person, not by replying.
Look at the mark before removing it, so you know which zone it came from.
Get-Content -Path 'C:\path\to\file.xlsm' -Stream Zone.IdentifierZoneId=3 is the internet zone and ZoneId=4 is restricted. Many files also carry HostUrl or ReferrerUrl, which tells you exactly where it was downloaded from — often more informative than asking the user.
Remove the mark.
Unblock-File -Path 'C:\path\to\file.xlsm'Reopen the file. The banner is gone and the macros run.
Get-Item 'C:\path\to\file.xlsm' -Stream * | Select-Object StreamMake the source folder a Trusted Location
An internal share or a controlled folder holds macro files people legitimately need. This is the supported answer and the one to prefer. Note before you start: a Trusted Location disables the macro warning for everything in it, permanently. Scope it to a specific folder that is write-controlled — never to a drive root or a user profile folder.
Pick a folder that is genuinely controlled — one where you know who can write to it. A Trusted Location exempts everything in it from the macro block, so a folder everyone can write to is a hole, not a fix.
Add the location for the application that needs it. Change Excel to Word or Access as required, and use the next free LocationN number.
$k = 'HKCU:\Software\Microsoft\Office\16.0\Excel\Security\Trusted Locations\Location20'New-Item -Path $k -Force | Out-NullSet-ItemProperty -Path $k -Name 'Path' -Value '\\fileserver\finance\macros\'Set-ItemProperty -Path $k -Name 'Description' -Value 'Finance macro workbooks'Set-ItemProperty -Path $k -Name 'AllowSubFolders' -Type DWord -Value 1
A UNC path additionally needs network locations to be permitted, which is off by default.
Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Office\16.0\Excel\Security\Trusted Locations' -Name 'AllowNetworkLocations' -Type DWord -Value 1Without this, a UNC Trusted Location is accepted silently and then ignored, which looks exactly like the fix not working.
Restart Excel and confirm the location appears under File → Options → Trust Center → Trust Center Settings → Trusted Locations.
For a fleet, deploy the same values through the Office administrative templates rather than by hand — Group Policy writes them under the Policies hive, where a user cannot remove them.
Understand the policy switch before anyone reaches for it
Someone has proposed turning the block off centrally. This fix is here to document what that does, not to recommend it. Turning it off organisation-wide removes the single most effective control against macro-delivered malware — it is a decision with a security consequence, not a configuration tweak, and it should be signed off rather than applied to clear a helpdesk ticket.
Understand what the switch is. "Block macros from running in Office files from the Internet" set to Disabled restores the pre-2022 behaviour, where a user gets an Enable Content button on any file from anywhere.
Check whether it is already set, since a policy someone applied years ago can be why an unexpected file ran.
Get-ItemProperty 'HKCU:\Software\Policies\Microsoft\Office\16.0\Excel\Security' -Name blockcontentexecutionfrominternet -ErrorAction SilentlyContinueA value of 0 means the block has been turned off for Excel. 1, or the value being absent, means it is on.
Prefer the alternatives in every case where they fit: unblock the individual file, use a Trusted Location for a controlled folder, or sign the macro project with a certificate and trust the publisher. All three keep the protection for everything else.
If it is turned off anyway, scope it to the specific application and the specific user group that needs it, record the decision, and set a date to revisit it.
Related faults
Where this stops. This write-up was written and checked by hand. It says what each step changes, how to confirm it worked and how to reverse it, and anything destructive is flagged before you reach it. If it does not match what your machine is doing, search the Support Centre for the exact code or message — and when something needs a person, get in touch.