logo
search
VBA & Macro Problems

How to Use Excel Macros with OneDrive and Excel for the Web

Kushani NimanthikaKushani Nimanthika Oct 9, 2026 869 views

Question details

The user needs to know how to execute VBA macros in an Excel workbook that is saved on OneDrive and accessed via Excel for the web.

How to Use Excel Macros with OneDrive and Excel for the Web
Product
Microsoft Excel
Device & OS
not provided
Scenario
Attempting to run automated VBA scripts on a cloud-stored workbook using the web-based version of Excel.
Observed behavior
Excel for the web can open and edit the workbook but lacks the functionality to run or edit VBA macros directly in the browser.
Before you start

Ensure that you have the Microsoft Excel desktop application installed on your computer, as VBA macros cannot be executed directly within a web browser environment.

Solution 1Recommended

Open the Workbook in the Excel Desktop App

Since Excel for the web does not support VBA execution, you must transition your session to the desktop application to run your macros while keeping the file synced to OneDrive.

Excel for the web is designed for lightweight editing and collaboration. To utilize advanced features like VBA macros, Microsoft provides a seamless transition button to open your cloud file in the full desktop software.

Any changes made or macros executed in the desktop app will automatically synchronize back to your OneDrive file, ensuring your data stays up to date in the cloud.

1
Open the file in Excel for the web

Navigate to your OneDrive account in your web browser and click on your macro-enabled workbook (.xlsm) to open it in Excel for the web.

2
Select 'Open in Desktop App'

Look at the ribbon menu at the top of the browser window. Click the 'Viewing' or 'Editing' button, then select 'Open in Desktop App' from the drop-down menu.

3
Enable macros and run

Once the workbook opens in your local Excel application, click 'Enable Content' in the security warning bar at the top, then run your VBA macros as you normally would.

Open the Workbook in the Excel Desktop App
Cloud Automation Alternatives: If you require automation that runs entirely in the cloud without needing a desktop application, consider rewriting your processes using Office Scripts or utilizing Microsoft Power Automate.
Free Microsoft Office alternative

Use WPS Office to Run VBA Macros Seamlessly

If you frequently work with macro-enabled workbooks and need a reliable, lightweight desktop solution, WPS Office provides excellent VBA support. It serves as a powerful, free alternative to Microsoft Office that handles .xlsm files perfectly.

  1. 1. Download and Install WPS Office: Visit the official WPS website to download and install the free WPS Office suite on your computer.
  2. 2. Open WPS Spreadsheet: Launch WPS Spreadsheet, which serves as a highly compatible desktop alternative to Microsoft Excel.
  3. 3. Run Your Macros: Open your macro-enabled workbook (.xlsm) in WPS Office, enable macros when prompted by the security warning, and run your VBA scripts seamlessly.
Fully compatible with Microsoft Excel formats, including standard .xlsx and macro-enabled .xlsm files.Built-in VBA editor makes it easy to run, edit, and create macros without expensive subscriptions.Lightweight application that installs quickly and runs smoothly even on older devices.Free to use with a highly familiar user interface, requiring zero learning curve for Excel users.
microsoft office alternative - wps office

Frequently Asked Questions

Can I edit the data in a macro-enabled workbook using Excel for the web?

Yes, Excel for the web allows you to open and edit the standard cell data within a macro-enabled workbook (.xlsm). However, you cannot run, edit, or view the actual VBA code while in the browser.

Why did my macros disappear when I saved my file in Excel for the web?

If you use 'Save As' and choose the standard Excel Workbook (.xlsx) format instead of a Macro-Enabled Workbook (.xlsm), all VBA code will be stripped from the file. Always ensure you are working with and saving in the correct .xlsm format.

Can Office Scripts replace my VBA macros on the web?

Office Scripts is a modern, cloud-based scripting language designed specifically for Excel for the web. While it cannot directly run your legacy VBA code, you can rewrite simple automation tasks using Office Scripts for pure web-based execution.