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:
- Close Excel.
- Open Windows File Explorer and navigate to the workbook.
- Right-click the
.xlsmor.xlsbfile and select Properties. - In the General tab, look at the bottom Security section.
- 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:
- Open File > Options > Trust Center > Trust Center Settings > Trusted Locations.
- Check the box at the bottom: Allow Trusted Locations on my network (not recommended).
- 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:
- Press
Win + R, typeinetcpl.cpl, and hit Enter to open Internet Properties. - Select the Security tab, click Local Intranet, then click Sites > Advanced.
- Add your organization’s SharePoint/cloud root URL (e.g.,
https://*.sharepoint.com). - Click Close and OK.
- Press
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:
- Your organization has deployed a security baseline disabling user-defined Trusted Locations.
- In this scenario, macros must either reside in an IT-mandated central repository or be signed with a trusted cryptographic certificate. For implementation details on certificates, refer to Digital Signatures: Fixing “The VBA project is not digitally signed.”
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:
- Open File > Options > Trust Center > Trust Center Settings.
- Select Macro Settings in the left pane.
- Ensure the setting is set to Disable VBA macros with notification.
- Avoid setting it to Disable all macros without notification, which suppresses the prompt and overrides folder-level trust in certain configurations.
- 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
| Symptom | Root Cause | Required Action |
|---|---|---|
| Yellow bar appears every open | Folder not in Trusted Locations | Add folder via Trust Center > Trusted Locations. |
| Red “Security Risk” banner | Windows Mark of the Web (MotW) | Right-click file > Properties > check Unblock. |
| Error when adding network path | Network paths disabled by default | Check Allow Trusted Locations on my network. |
| Buttons grayed out in Trust Center | Organization Group Policy (GPO) | Contact IT administrator or use a digital signature. |
| Macros fail only on SharePoint/OneDrive | URL pathing treated as Internet zone | Add 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.