VBA & Macro Problems

Fix Excel Workbook_Open Macro Running Repeatedly from OneDrive

Huda QurayshiHuda Qurayshi Nov 4, 2026 869 views

Question details

The Workbook_Open macro in an XLSM file executes continuously or repeatedly when editing the file stored in OneDrive.

Fix Excel Workbook_Open Macro Running Repeatedly from OneDrive
Product
Microsoft Excel, OneDrive
Device & OS
not provided
Scenario
Editing a macro-enabled Excel workbook (XLSM) stored in a synced OneDrive folder.
Observed behavior
The Workbook_Open event triggers repeatedly every few seconds during normal editing, making it seem like the file is constantly reopening or refreshing.
Before you start

Ensure you have saved a local copy of your XLSM file outside of the OneDrive sync folder to prevent accidental data loss or macro corruption during troubleshooting.

Solution 1Recommended

Test the File Locally and Pause OneDrive Sync

Isolating the file from OneDrive synchronization helps determine if sync conflicts or background file-locking mechanisms are triggering the macro.

OneDrive's synchronization process or the AutoSave feature can occasionally lock the file state in the background. This can trick Excel into executing the Workbook_Open event repeatedly as the file state is refreshed.

1
Pause OneDrive Sync

Click the OneDrive cloud icon in your system tray, click the 'Help & Settings' gear icon, select 'Pause syncing', and choose '2 hours'.

2
Move the File Locally

Copy the affected XLSM workbook from your OneDrive folder and paste it into a local, non-synchronized directory like your Desktop or Documents folder.

3
Test Macro Behavior

Open the local copy of the workbook in Excel and edit it normally to see if the Workbook_Open macro continues to trigger repeatedly.

Test the File Locally and Pause OneDrive Sync
Identifying the Cause: If the macro stops repeating in the local copy, the issue is directly related to OneDrive's sync client or AutoSave pushing changes to the cloud.
Free Microsoft Office alternative

Try WPS Office for Seamless Macro Execution

If Microsoft Excel and OneDrive synchronization issues continue to disrupt your VBA workflows, consider switching to WPS Office. It provides a highly stable environment for running complex macros without unexpected reload interruptions.

  1. 1. Download and Install WPS Office: Get the free WPS Office installer from the official website and complete the setup.
  2. 2. Open Your XLSM File: Launch WPS Spreadsheets, click 'Open', and select your macro-enabled workbook.
  3. 3. Enable Macros: Click 'Enable Macros' in the security warning prompt to seamlessly run your VBA code.
Fully compatible with Microsoft Excel formats including .xlsx, .xlsm, and .csvRobust support for VBA and macros for advanced spreadsheet automationBuilt-in WPS Cloud for stable file synchronization without constant reload bugsLightweight, fast installation, and free to download
microsoft office alternative - wps office

Frequently Asked Questions

Why does the Workbook_Open macro trigger randomly during editing?

When an XLSM file is stored in a synced location like OneDrive, background synchronization or the AutoSave feature can temporarily lock and refresh the file state. This process can trick Excel into registering a new file open action, thereby triggering the Workbook_Open event repeatedly.

Can multiple users editing the file trigger the Workbook_Open macro?

Yes. If the workbook is shared and multiple users are editing it simultaneously via OneDrive or SharePoint, synchronization updates pushed to your device might cause the workbook to refresh and re-run the open event.

How can I prevent AutoSave from interfering with my Excel macros?

You can disable AutoSave specifically for macro-heavy workbooks by toggling off the AutoSave switch in the top-left corner of the Excel window. Alternatively, you can move the file to a local, un-synced directory while running complex VBA scripts.

Does my version of OneDrive affect Excel macro execution?

Yes, certain builds of the OneDrive sync client or Microsoft Excel can have synchronization conflicts that cause unexpected behaviors, including repeating macros. Updating both applications to their latest builds often resolves these bugs.