“Macros have been disabled”: Troubleshooting the “Trusted Locations” security block.

The “Macros have been disabled” alert appears when Microsoft Excel prevents Visual Basic for Applications (VBA) code from running because the workbook is stored in a folder that Excel considers untrusted. By default, Excel blocks automated scripts to protect your system from malicious code. Adding your directory to Excel’s Trusted Locations whitelist tells the security engine that every workbook in that folder is safe to execute without prompting warnings or blocking macros.

Quick Fix: Add a Folder to Trusted Locations

To add a folder to your trusted locations in Excel, navigate to File > Options > Trust Center, select Trust Center Settings…, and click Trusted Locations in the left sidebar. Next, click Add new location…, use the Browse button to select the folder holding your macro workbook, and optionally check Subfolders of this location are also trusted if needed. Finally, click OK on both open dialog windows and restart Excel to apply the changes.

Step-by-Step Diagnostic Path

If adding a folder did not solve the issue, or if Excel refuses to save the trusted path, follow this sequence to identify why the security block remains active.

Is the file in a local, network, or cloud folder?
├── Local Folder (C:\...) ──────► Check for Windows "Mark of the Web" (Unblock in File Properties)
├── Network Share (\\server) ───► Enable "Allow Trusted Locations on my network" in Trust Center
└── Cloud / OneDrive / SharePoint
      ├── Mapped / Synced Path ─► Add local synced path or configure Internet Options Intranet Zone
      └── Cloud Autosave ──────► [Fixing VBA errors caused by "OneDrive" autosave and temp file paths](<http://www.excelerrorfix.com/vba-debugging/vba-system-environment-conflicts/vba-onedrive-autosave-path-errors>)

1. The Red Security Banner vs. Yellow Warning Bar

Check the color and text of the security banner displayed at the top of your worksheet:

  • Yellow Message Bar (“Macros have been disabled”): Excel is using standard Trust Center policy. Adding the folder to Trusted Locations or clicking Enable Content resolves this immediately.
  • Red Security Risk Banner (“Microsoft has blocked macros from running because the source of this file is untrusted”): This occurs on files downloaded from the internet, email attachments, or messaging apps. Excel flags these files with the Windows Mark of the Web (MotW) attribute. A Trusted Location rule may be bypassed entirely until the file is unblocked at the operating system level.

To remove Mark of the Web:

  1. Close Excel.
  2. Open Windows File Explorer and navigate to the workbook.
  3. Right-click the .xlsm or .xlsb file and select Properties.
  4. In the General tab, look at the bottom Security section.
  5. Check the Unblock box and click Apply > OK.

2. Network Drives and UNC Paths

By default, Excel disables Trusted Locations located on shared network servers (paths starting with \\server\share or mapped drive letters like Z:\).

To enable trusted network paths:

  1. Open File > Options > Trust Center > Trust Center Settings > Trusted Locations.
  2. Check the box at the bottom: Allow Trusted Locations on my network (not recommended).
  3. Click Add new location… and enter the full UNC path (e.g., \\fileserver\finance\macros\) rather than the mapped drive letter. Mapped letters can disconnect or resolve differently across corporate sessions, causing intermittent blocks.

3. Cloud Storage, OneDrive, and SharePoint Sync

Excel cannot directly validate standard web URLs (such as https://company.sharepoint.com/...) as a standard local Trusted Location path in older dialogs. If your file syncs through OneDrive or SharePoint:

  • Add the Local Sync Folder: Add the local mirror folder (e.g., C:\Users\username\Company\SharePointFolder) as a Trusted Location and check Subfolders of this location are also trusted.
  • Add to Local Intranet in Windows:
    1. Press Win + R, type inetcpl.cpl, and hit Enter to open Internet Properties.
    2. Select the Security tab, click Local Intranet, then click Sites > Advanced.
    3. Add your organization’s SharePoint/cloud root URL (e.g., https://*.sharepoint.com).
    4. Click Close and OK.

If macros fail specifically during cloud synchronization or path resolution, review Fixing VBA errors caused by “OneDrive” autosave and temp file paths.

4. Group Policy Restrictions (Enterprise Environments)

In enterprise environments, IT administrators often manage macro security centrally via Group Policy Objects (GPO).

If the Add new location… button is grayed out, or if changes disappear after restarting your computer:

Verifying Macro Settings

If the folder is trusted and Mark of the Web is cleared, confirm that global VBA execution is not blocked across the entire application:

  1. Open File > Options > Trust Center > Trust Center Settings.
  2. Select Macro Settings in the left pane.
  3. Ensure the setting is set to Disable VBA macros with notification.
  4. Avoid setting it to Disable all macros without notification, which suppresses the prompt and overrides folder-level trust in certain configurations.
  5. Verify that Enable Excel 4.0 (XLM) macros is checked only if your legacy workbook relies on old formula-sheet macros rather than standard VBA modules.

Diagnostic Summary Table

SymptomRoot CauseRequired Action
Yellow bar appears every openFolder not in Trusted LocationsAdd folder via Trust Center > Trusted Locations.
Red “Security Risk” bannerWindows Mark of the Web (MotW)Right-click file > Properties > check Unblock.
Error when adding network pathNetwork paths disabled by defaultCheck Allow Trusted Locations on my network.
Buttons grayed out in Trust CenterOrganization Group Policy (GPO)Contact IT administrator or use a digital signature.
Macros fail only on SharePoint/OneDriveURL pathing treated as Internet zoneAdd local sync path and configure Windows Intranet zone.

If the security banner is gone but clicking a button still produces an error stating that code cannot execute, the workbook may have missing library references or broken project objects. Consult Fixing “Cannot run the macro… The macro may not be available in this workbook.” to diagnose runtime calling breaks.