How to Enable Excel Macros in OneDrive Files Using Registry
Question details
The user needs to enable editing and macro execution for Excel files stored in OneDrive by modifying system registry settings.

- 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 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.
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.
Press the Windows key, type 'cmd' or 'Command Prompt' into the search bar, right-click the application, and select 'Run as administrator'.
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
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.
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.

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. Download WPS Office: Visit the official WPS website and click 'Download WPS Office Free' to get the latest version.
- 2. Install the Software: Run the installer and follow the quick on-screen instructions to set up WPS on your device.
- 3. Open Your Spreadsheets: Launch WPS Spreadsheets and directly open your local or cloud-synced Excel files to start working seamlessly.

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.




