How to Enable VBA Macros in Excel Files Shared via OneDrive
Question details
Users need to enable VBA macros for Excel workbooks shared via OneDrive, which frequently trigger macro-disabled warnings.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Accessing and running VBA macros in a shared Excel file (.xlsm) synchronized through OneDrive.
- Observed behavior
- A macros-disabled security warning appears, preventing the VBA code from executing, even if the creator originally enabled macros on their own computer.
Verify that the shared Excel file comes from a trusted source, as enabling macros can expose your computer to malicious code if the workbook is not secure.
Configure Excel Trust Center Settings for Macros
Modify the local Trust Center settings on each computer accessing the shared file to allow VBA macros to execute safely.
Macro security settings are configured separately on each user's local device, not within the Excel file itself. When sharing a macro-enabled workbook via OneDrive, every collaborator must adjust their local Excel application settings to permit the macros to run.
Launch Microsoft Excel, open the shared file from OneDrive, and click on File in the top-left corner. Select Options at the bottom of the menu.
In the Excel Options dialog box, click on Trust Center in the left-hand navigation pane, then click the Trust Center Settings button on the right.
Select Macro Settings from the left menu. Choose your desired security level, such as 'Enable all macros' (for trusted environments) or 'Disable all macros with notification'.
Check the box next to 'Trust access to the VBA project object model' if your shared macros need to interact with the VBA environment itself.
Click OK to save your changes. You must repeat this exact configuration process on every user's computer that needs to run the macros in the shared OneDrive file.

Try WPS Office for Seamless Macro and Spreadsheet Management
If you frequently encounter macro security issues or sync warnings in Microsoft Excel, consider switching to WPS Office. It provides robust spreadsheet capabilities, an intuitive interface, and excellent compatibility with Microsoft formats.
- 1. Download the Installer: Visit the official WPS Office website and download the free installation package.
- 2. Install WPS Office: Run the installer and follow the on-screen instructions to set up the software on your device.
- 3. Open Your Spreadsheets: Launch WPS Spreadsheet and easily open your macro-enabled workbooks with full format compatibility.

Frequently Asked Questions
Why do my Excel macros work locally but not when shared on OneDrive?
Macro security settings are stored locally on your computer's registry, not embedded within the Excel file. When you share a file via OneDrive, other collaborators must also configure their local Excel Trust Center settings to allow macros to run.
Is it safe to select 'Enable all macros' in Excel's Trust Center?
Enabling all macros can expose your computer to malicious scripts. This setting is only recommended if you are absolutely certain that all files you open come from a trusted, verified source.
How can I trust a specific OneDrive folder without enabling all macros globally?
You can add your synced OneDrive folder to Excel's Trusted Locations. Go to File > Options > Trust Center > Trust Center Settings > Trusted Locations, click 'Add new location', and select the local path of your OneDrive sync folder.
Do I need to enable 'Trust access to the VBA project object model'?
You only need to enable this option if your VBA macro specifically contains code that manipulates the VBA environment itself (like adding or modifying other macros). Standard macros usually do not require this setting.




