logo
search
VBA & Macro Problems

How to Run Excel VBA Macros in SharePoint and OneDrive Shared Workbooks

Nimra MalikNimra Malik Oct 9, 2026 869 views

Question details

The user wants to know if Excel VBA macros are supported in workbooks shared via SharePoint and OneDrive, and how to safely run them without causing issues.

Managing Excel VBA Macros in SharePoint and OneDrive Shared Workbooks
Product
Microsoft Excel
Device & OS
not provided
Scenario
Collaborating on macro-enabled workbooks hosted on cloud platforms like SharePoint or OneDrive.
Observed behavior
VBA macros do not execute in Excel for the web, and running them in the desktop app during simultaneous editing can lead to sync conflicts, AutoSave errors, or file corruption.
Before you start

Ensure you have the desktop version of Excel installed, as Excel for the web does not support running, viewing, or editing VBA macros.

Solution 1Recommended

Use Desktop Excel and Adjust Co-authoring Settings

Since the web version cannot execute VBA, you must open the shared workbook in the desktop application and manage sync settings to prevent file corruption.

Running complex macros that alter worksheet structures while multiple users are actively editing can cause severe synchronization conflicts in OneDrive and SharePoint.

1
Open in Desktop App

Navigate to your file in SharePoint or OneDrive online, click on 'Viewing' or 'Editing' in the ribbon, and select 'Open in Desktop App'.

2
Disable AutoSave During Macro Execution

If your VBA macro applies heavy structural changes, temporarily toggle off the 'AutoSave' switch in the top-left corner of the Excel window before running the macro.

3
Coordinate Multi-User Access

Communicate with your team to ensure that only one person executes heavy macros or modifies the VBA code at any given time to avoid overriding each other's changes.

Use Desktop Excel and Adjust Co-authoring Settings
File Recovery: If a macro conflict corrupts your file, use SharePoint or OneDrive's built-in 'Version History' to restore a previous, uncorrupted version of the workbook.
Free Microsoft Office alternative

Experience Seamless VBA Compatibility with WPS Office

If managing complex VBA macros in shared Microsoft Excel environments causes continuous sync conflicts, consider trying WPS Office. It provides a highly compatible, lightweight alternative with robust local macro support for uninterrupted workflow automation.

  1. 1. Download and Install: Visit the official WPS Office website to download and install the free software on your device.
  2. 2. Open Your Spreadsheet: Launch WPS Spreadsheets and open your .xlsm file to seamlessly view and edit your data.
  3. 3. Enable Macros: Click 'Enable Macros' in the security warning prompt at the top of the worksheet to run your VBA scripts smoothly.
Fully compatible with Microsoft Excel macro-enabled formats (.xlsm, .xlsx, .xls).Robust built-in support for VBA macros to automate complex spreadsheet tasks safely.Lightweight software architecture ensuring fast startup and smooth performance.Familiar user interface allows for a zero-learning-curve transition from Microsoft Office.
microsoft office alternative - wps office

Frequently Asked Questions

Can I run Excel VBA macros directly in a web browser?

No, Excel for the web does not support running, editing, or viewing VBA macros. You must open the macro-enabled workbook in the desktop version of Excel to utilize any VBA functionality.

Why does my shared macro-enabled workbook keep getting corrupted?

Corruption often occurs during simultaneous editing by multiple users, especially when a macro actively changes the workbook's structure (like adding/deleting rows or sheets). It is best practice to disable AutoSave while running heavy macros or restrict macro execution to one user at a time.

How do I recover a corrupted macro workbook hosted in SharePoint?

You can use the Version History feature. Navigate to the file in your SharePoint document library, click the three dots (ellipses) next to the file name, select 'Version History', and restore a previous version from before the corruption occurred.

Are Office Scripts a better alternative for shared workbooks?

Yes, for cloud-heavy and multi-user environments, Office Scripts are often recommended as a modern alternative to VBA. They run natively in Excel for the web and integrate seamlessly with Power Automate, significantly reducing the sync conflicts associated with traditional VBA.