A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
The new PC is treating the downloaded OneDrive files as coming from the Internet and adding Mark of the Web (ZoneId=3), so Excel blocks macros by default. To restore the previous behavior, the files must either lose Mark of the Web or come from a location/zone that Office trusts.
Use these approaches that scale for many files:
- Remove Mark of the Web from downloaded files
- When a file is downloaded to Windows, it gets Mark of the Web if it’s from the Internet or Restricted sites zones. Files with ZoneId=3 (Internet) have macros blocked by default.
- To unblock macros in a file on the local device, remove Mark of the Web:
- Save the file locally.
- In File Explorer, right‑click the file > Properties.
- On the General tab, select the Unblock checkbox (if present) and select OK.
- If the Unblock checkbox is missing or there are many files, use PowerShell’s
Unblock-Filecmdlet to remove the ZoneId for multiple files in a folder. Removing the ZoneId value allows VBA macros to run by default and is equivalent to selecting Unblock in Properties.
- Prefer opening directly from OneDrive using the sync client or “Open in Desktop App”
- If the OneDrive sync client downloads a file, that file does not have Mark of the Web.
- Files in Windows known folders (Desktop, Documents, Pictures, Screenshots, Camera Roll) that are synced to OneDrive also do not have Mark of the Web.
- For files stored on OneDrive or SharePoint (including those used by Teams):
- Have users open the file using the Open in Desktop App option from OneDrive/SharePoint. Files opened this way do not get Mark of the Web.
- Or ensure the shared OneDrive folder is synced locally via the OneDrive sync client and work from the synced folder path instead of downloading via a browser.
- Use Trusted Locations for a shared macro-working folder
- For users (or a department such as Finance) that must use macro-enabled files from OneDrive/SharePoint without macros being blocked:
- Have them download the files to a folder configured as a Trusted Location in Office, then open and work from there.
- This avoids per-file unblocking and keeps macros enabled for all files in that folder.
- For users (or a department such as Finance) that must use macro-enabled files from OneDrive/SharePoint without macros being blocked:
- Configure OneDrive/SharePoint domains as Trusted Sites (admin-level change)
- If the shared OneDrive is accessed via a browser and files are downloaded, the Windows Internet security zone configuration determines whether Mark of the Web is set.
- Admins can use the “Site to Zone Assignment List” Group Policy to place the organization’s OneDrive/SharePoint domains (for example,
https://{your-domain-name}-my.sharepoint.com) into the Trusted Sites zone. Files downloaded from Trusted Sites (ZoneId=2) do not have macros blocked by default. - This is a broad trust decision and should be managed carefully, because macros from these locations will not be blocked.
- Verify zone and Mark of the Web behavior
- To confirm why a file is blocked:
- Check its ZoneId by running:
If ZoneId=3 (Internet), macros are blocked by default.notepad {file-name}:Zone.Identifier
- Check its ZoneId by running:
- To see which locations are in Trusted sites or Local intranet zones, go to Control Panel > Internet Options > Security > select each zone and view the site list.
- To confirm why a file is blocked:
In practice for this scenario:
- Ensure the shared OneDrive is synced locally via the OneDrive sync client and always open the Excel files from the synced folder or via Open in Desktop App. Those files will not have Mark of the Web, so macros will run as they did on the old PC.
- If some files are already downloaded and blocked, bulk-unblock them using
Unblock-Fileor by moving them into a Trusted Location and removing Mark of the Web once.
References: