How to Edit Excel VBA Macros in a Shared Online Workbook
Question details
The user needs to know how to create, edit, or run VBA macros within an Excel workbook that is shared online via OneDrive or SharePoint.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Collaborating on macro-enabled workbooks (.xlsm) stored in a cloud environment like OneDrive or SharePoint.
- Observed behavior
- While workbook data can be edited seamlessly in Excel for the Web, VBA macros cannot be viewed or executed in the browser and must be managed through the desktop application.
Ensure that your shared file is saved in the macro-enabled workbook format (.xlsm) and that you have the Microsoft Excel desktop application installed on your computer, as web versions do not support VBA editing.
Use Excel Desktop App for Shared VBA Workbooks
Since Excel for the Web cannot process VBA, you must open the shared cloud file in the desktop app to modify macro code.
Excel for the Web is excellent for real-time data entry and basic formatting, but it lacks the backend support required to run or edit Visual Basic for Applications (VBA).
To maintain your macros, the file can remain in the cloud, but the actual editing must take place in the full desktop client.
Ensure your macro-enabled workbook (.xlsm) is uploaded to your OneDrive or SharePoint document library.
Click the 'Share' button in your cloud drive interface to invite team members to collaborate on the file.
When viewing the file in Excel for the Web, click the 'Viewing' or 'Editing' dropdown menu on the ribbon, and select 'Open in Desktop App' to launch the full Excel client.
Once the workbook opens in the desktop application, press Alt + F11 to open the VBA Editor. You can now create, modify, or run your macros while your changes continue to sync to the cloud.

Try WPS Office for Macro-Enabled Spreadsheets
If you need a reliable desktop application to handle VBA macros and complex spreadsheet tasks without heavy subscriptions, WPS Office is an excellent choice. It offers high compatibility with Microsoft formats and provides a lightweight, familiar interface.

Frequently Asked Questions
Can I run VBA macros in Excel for the Web?
No, Excel for the Web does not support running, creating, or editing VBA macros. You must open the workbook in the Excel desktop application to utilize macro functionalities.
Will my macros be deleted if someone edits the file in Excel for the Web?
No, VBA macros are preserved in the background when a macro-enabled workbook is opened and edited in Excel for the Web, even though they cannot be executed or viewed directly in the browser.
How do I share a macro-enabled workbook (.xlsm)?
You can upload your .xlsm file to cloud services like OneDrive or SharePoint and use the standard 'Share' feature to generate a link or send direct email invitations to your collaborators.
Can multiple users edit VBA code simultaneously in a shared workbook?
Editing VBA code does not support real-time co-authoring. To prevent file conflicts and code corruption, only one user should access the VBA Editor in the desktop application at a time.




