VBA & Macro Problems

How to Run VBA Macros in an Excel Workbook Stored on SharePoint

Olivia MillerOlivia Miller Oct 19, 2026 872 views

Question details

The user needs to know how to execute VBA macros in an .xlsm Excel file hosted on SharePoint without encountering read-only restrictions or co-authoring conflicts.

How to Run VBA Macros in an Excel Workbook Stored on SharePoint
Product
Microsoft Excel
Device & OS
not provided
Scenario
Opening and executing a macro-enabled workbook (.xlsm) that is stored on a shared SharePoint server.
Observed behavior
Macros fail to run if the file opens in Excel for the Web, is in read-only mode, or if multiple users are attempting to co-author the macro-enabled workbook simultaneously.
Before you start

Ensure you have the desktop version of Microsoft Excel installed on your device, as VBA macros cannot be executed in the web version of Excel. Additionally, verify that your SharePoint permissions allow you to edit the file.

Solution 1Recommended

Open the Workbook in the Excel Desktop Application

VBA macros require the full desktop version of Excel and exclusive editing rights to run properly.

SharePoint defaults to opening files in Excel for the Web, which does not support VBA macros. Additionally, macro-enabled workbooks (.xlsm) do not support Excel's co-authoring feature. If another user is actively editing the file, it will open in read-only mode, which prevents macros from running.

1
Locate the file in SharePoint

Navigate to your .xlsm file in your SharePoint document library using your web browser.

2
Launch in the desktop app

Click the three dots (ellipses) next to the file name to open the context menu, select 'Open', and then choose 'Open in app' to launch the file in the Excel desktop application.

3
Enable macros

If prompted with a security warning at the top of the spreadsheet, click the 'Enable Content' button to allow the VBA macros to execute.

Open the Workbook in the Excel Desktop Application
Co-authoring Limitation: If you receive a 'File in use' error, another user is currently editing the document. You must wait for them to close the file to gain edit access and run your macros, as co-authoring is disabled for files with embedded VBA.
Free Microsoft Office alternative

A Lightweight and Compatible Alternative for Your Spreadsheets

If SharePoint co-authoring limitations and complex macro restrictions in Microsoft Office are slowing you down, consider trying WPS Office. It is a free, lightweight, and highly compatible suite that supports Microsoft Excel formats natively, providing a seamless and efficient spreadsheet experience.

  1. 1. Download WPS Office: Visit the official WPS Office website to download the free suite and install it on your computer.
  2. 2. Open Your Spreadsheet: Launch WPS Spreadsheets and open your Excel files directly.
  3. 3. Edit with Ease: Enjoy editing your documents with a familiar interface and save your work securely.
Fully compatible with Microsoft Excel file formats, including .xlsx, .xlsm, and .csvLightweight application that opens large data files rapidly without system lagFamiliar user interface ensuring a seamless migration from Microsoft OfficeRobust offline capabilities so you are not restricted by cloud co-authoring issues
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get a read-only error when opening a macro-enabled workbook from SharePoint?

This error occurs when another user is currently editing the file. Macro-enabled workbooks (.xlsm) do not support the Excel co-authoring feature. Only one person can edit the file and execute its macros at any given time.

Can I run VBA macros in Excel for the Web?

No, VBA macros are not supported in Excel for the Web. You must open the workbook in the Microsoft Excel desktop application to enable content and run any VBA code.

Why are my Workbook_Change events not triggering after downloading from SharePoint?

Ensure that your Workbook_Change event procedures are placed correctly inside the 'ThisWorkbook' module in the VBA editor. If they are placed in a standard module or a specific worksheet module, the workbook-level events will not trigger.