logo
search
VBA & Macro Problems

How to Enable Excel Macros in OneDrive Files Using Registry

Ayan MasoodAyan Masood Oct 9, 2026 869 views

Question details

The user needs to enable editing and macro execution for Excel files stored in OneDrive by modifying system registry settings.

How to Enable Excel Macros in a OneDrive File
Product
Microsoft Excel
Device & OS
Windows
Scenario
Opening an Excel file from OneDrive that has macros blocked due to Microsoft Office's internet source restrictions.
Observed behavior
Macros and editing capabilities are blocked by default for files originating from the internet, requiring a registry tweak to bypass the restriction.
Before you start

Before modifying the Windows Registry, carefully verify that you trust the source of your Excel files, as enabling macros globally can expose your system to malicious scripts.

Solution 1Recommended

Use Command Prompt to Modify Excel Security Settings

Run a specific REG ADD command to allow macro execution from internet sources like OneDrive.

This method updates the BlockContentExecutionFromInternet registry value for Excel 2016 and later (version 16.0). By setting this value to 0, you disable the strict block on internet-sourced macros, allowing you to enable them via the standard security warning prompt.

1
Open Command Prompt

Press the Windows key, type 'cmd' or 'Command Prompt' into the search bar, right-click the application, and select 'Run as administrator'.

2
Execute the Registry Command

In the Command Prompt window, type or paste the following command exactly: REG ADD HKCU\SOFTWARE\Microsoft\Office\16.0\Excel\Security /v BlockContentExecutionFromInternet /t REG_DWORD /d 0

3
Confirm the Operation

Press Enter to execute the command. If you receive a prompt asking to overwrite an existing value, type 'Y' and press Enter. A 'The operation completed successfully' message should appear.

4
Enable Macros in Excel

Restart Microsoft Excel and open your OneDrive file. When the security warning appears at the top of the spreadsheet, click 'Enable Editing' and 'Enable Content' to activate the macros.

Use Command Prompt to Modify Excel Security Settings
Security Warning: This setting reduces Microsoft Office's built-in protection against macro-based malware. Ensure you only enable macros on files from fully trusted sources.
Free Microsoft Office alternative

Try WPS Office for a Smoother Spreadsheet Experience

If you find Microsoft Excel's strict registry locks and macro blocking policies frustrating, consider switching to WPS Office. It provides a lightweight, highly compatible spreadsheet environment without the complex system configuration hurdles.

  1. 1. Download WPS Office: Visit the official WPS website and click 'Download WPS Office Free' to get the latest version.
  2. 2. Install the Software: Run the installer and follow the quick on-screen instructions to set up WPS on your device.
  3. 3. Open Your Spreadsheets: Launch WPS Spreadsheets and directly open your local or cloud-synced Excel files to start working seamlessly.
Highly compatible with Microsoft Excel formats including .xlsx, .xls, and .csvLightweight installation that runs smoothly on older and modern hardwareFamiliar user interface that requires zero learning curve for Office usersFree built-in PDF toolkit and advanced data analysis features
microsoft office alternative - wps office

Frequently Asked Questions

Why does Excel block macros in files synced from OneDrive?

Microsoft Office includes a security feature called 'Mark of the Web' (MOTW). It automatically blocks macros in files downloaded from the internet or synced via cloud services like OneDrive to protect your computer from potentially malicious code.

Can I unblock a specific file without changing the registry?

Yes. Instead of using the registry command, you can right-click the specific Excel file in Windows File Explorer, select 'Properties', check the 'Unblock' box at the bottom of the General tab, and click 'Apply'. This enables macros for that single file.

How do I reverse this registry change in the future?

To restore the default security settings, open Command Prompt as an administrator and run the same command, but change the '0' at the end to '1'. Alternatively, you can open the Registry Editor (regedit) and delete the BlockContentExecutionFromInternet value manually.