Do Macros Run in Excel Online? | 4 Ways to Run VBA in the Cloud

When you put an Excel workbook that runs your monthly roll-up with VBA macros on Teams or OneDrive and open it in a browser, you can't find the button to run the macro. More and more people run into this after moving to remote work or replacing their PCs.

This article explains why macros don't run in Excel for the web (Excel Online) and compares 4 ways to run a macro's work in the cloud. It also covers how to convert and run VBA macros in Samurai App, which code patterns can't be converted, and how to run them in Windows Excel without converting.

Summary

  • VBA macros don't run in Excel for the web. In Microsoft's official comparison table, VBA macros in Excel on the web are marked "No". VBA was built for the desktop.
  • To run the same processing in a browser or the cloud, you either rewrite the macro in another language or keep Windows Excel and run it there.
  • The main rewrite targets are Microsoft's Office Scripts (TypeScript) and Google's Apps Script. Depending on how the VBA is written, neither can convert it automatically.
  • When you open an .xlsm in Samurai App, it lists the VBA macros, and procedures it can convert are turned into TypeScript and run in the browser. Macros that use UserForms or file operations are not converted; they run in Windows Excel.

Why macros don't run in Excel for the web

VBA is a language built into the desktop version of Excel, and it can directly operate on files and other apps on the PC. That nature doesn't fit how the cloud works, so Microsoft provides a separate mechanism for automation on the web (Office Scripts).

Microsoft Learn's "Differences between Office Scripts and VBA macros" lays out the supported environments as follows.

Excel on the web Excel for Windows Excel for Mac Power Automate
Office Scripts Yes Yes Yes Yes
VBA macros No Yes Yes No

The same page also notes that Office Scripts require a business or education license, and that they don't run on Excel events such as opening a workbook: you have to start them by hand or call them from Power Automate.

4 ways to run a macro's work in the cloud

Method Rewrite Scheduled runs Best when
Rewrite as Office Scripts Required (TypeScript) From Power Automate You have a Microsoft 365 business license
Move to Google Sheets and Apps Script A conversion tool exists. Some parts need fixing by hand Apps Script triggers You're consolidating on Google Workspace
Keep Windows Excel Not needed With RPA or Windows tasks The VBA depends on UserForms or operating other apps
Use a service that converts and runs VBA Not needed within what it can convert Depends on the service You don't have the people to rewrite

Rewrite as Office Scripts

Office Scripts is Excel's automation mechanism, written in TypeScript. You can also create scripts by recording actions. If you call them from a Power Automate flow, they can run on a schedule without opening Excel. Microsoft's comparison page doesn't describe any automatic conversion from VBA, so in principle you rewrite.

Move to Google Sheets and Apps Script

Google publishes the "Macro Converter" add-on, which converts the VBA in Excel files to Apps Script. However, some VBA triggers aren't converted automatically, and for macros that use CreateObject, Shell.execute, and the like, Google advises reconsidering the conversion itself. The file format also changes to Google Sheets.

Keep Windows Excel

Macros that use UserForms (input screens), operate other apps, or work with files in shared company folders turn into something else when rewritten. For these, the realistic choice is to keep Excel on a Windows PC or virtual machine and run them there.

Inventory your macros before moving

Whichever method you choose, start by listing the macros you have. Whether a macro can move depends on what it touches.

What to check Easy to move Hard to move
What it touches Only cells in the open workbook Other workbooks, files in folders, other apps
How it starts A button or run by hand Events such as opening the workbook or changing a cell
Screens Shows no screen Shows an input screen with a UserForm
External connections None Databases or sending email

In the list, write each macro's name, what it does, who uses it and when, and the answers to the 4 questions above. For a workbook where many macros fall in the hard-to-move column, it can be faster to keep it in Windows Excel than to force a rewrite.

How to run VBA in Samurai App

Samurai App opens .xlsx, .xlsm, .csv, and .tsv files in a spreadsheet view in the browser, even on a PC without Excel installed. An .xlsm is saved as an .xlsm, and the VBA macros are kept without a single byte changed, so they run as before when you open the file in Excel later.

1. Open the .xlsm and look at "Macros"

Put the file in "Files" or attach it to a conversation and open it, then open "Macros" above the sheet. The workbook's VBA macros are listed under "VBA (Excel macros)". Only public Subs with no arguments in standard modules are listed.

2. Check the converted code and run it

Macros that can be converted get a "Run" button. The first time you run one, the original VBA and the converted TypeScript are shown side by side, so check them before running. As long as the converted code doesn't change, you won't be asked again.

The results appear on the sheet in the browser. The sheet's "Undo" (⌘Z) reverses one run all at once. If the macro selects another sheet (Sheets("…").Select), the view also switches to that sheet after the run.

3. Ask the AI to run it

You can also ask the AI agent to run a macro in a conversation. Once you check the macro's contents on the approval card, the agent runs it. "Always allow" applies only to that macro, and you'll be asked again if its contents change.

Run the "Monthly roll-up" macro in the attached sales-summary.xlsm and tell me the total on the summary sheet

4. Write new processing as TypeScript macros

Press "New macro" from "Edit" under "Macros" to write a macro in the same style as Office Scripts (function main(workbook: ExcelScript.Workbook) { … }). When you save, it goes into the workbook and travels with the file. Excel keeps this macro in the file but doesn't run it.

Run macros that can't be converted in Windows Excel

VBA that uses the following is not converted. Instead of a button, the matching lines and the reason are shown.

  • UserForm, ActiveX, Declare, Shell
  • Reading and writing files
  • With, For Each, GoTo, error handling (On Error and so on)

Macros that are too large are also not converted, with a message saying so. Run these in Windows Excel. If you keep Samurai App's CLI (samuraiapp) running on a Windows PC, the AI agent can operate that PC's Excel and run the workbook's macros.

See the Excel feature page for details.

Limits and where it doesn't fit

  • One run is limited to 10 seconds and 5,000 cell writes. If a run hits a limit or fails partway, the sheet doesn't change at all. Macros that rewrite hundreds of thousands of rows one by one don't suit this view.
  • Macros can't touch the internet or other files. Processing such as opening another workbook to collect values, or reading the files in a folder one after another, can't be converted. To roll up multiple files, attach them to a conversation and ask the AI.
  • The browser view opens workbooks up to 25MB. For larger files, ask the AI in a conversation, and it reads them in a cloud runtime to aggregate or reshape them.
  • Up to 50 macros per workbook, and each macro's source can be up to 64KB.
  • Values in the view can differ from Excel. If there are functions this view doesn't have, or formulas using INDIRECT or OFFSET, a notice appears above the sheet. Open the file in Excel to confirm the final values.
  • There is no way for multiple people to edit the same workbook at the same time.

FAQ

Is there a setting to enable macros in Excel Online?

No. In Microsoft's comparison table, Excel on the web doesn't support VBA macros. To automate on the web, use Office Scripts.

Will macros disappear if I open an .xlsm on the web or in another tool?

It depends on the tool. In Samurai App's view, an .xlsm is saved as an .xlsm and the VBA is left untouched. If you open and save in another tool, check that tool's documentation.

Can macros run automatically on a schedule?

Office Scripts can run from a Power Automate flow, and Apps Script from a trigger. If you stay with VBA, you need something that operates Windows Excel (RPA or scheduled tasks).

The person who knew VBA has left the company. What should we do?

Start by writing down which macro in which workbook does what. If you open the workbook in Samurai App, you can read the original VBA and the converted code side by side for macros that can be converted, which gives you a starting point for understanding what they do.

Sources

Checked against each vendor's official documentation and the Samurai App documentation as of November 9, 2026.

Related featureProcess large Excel files in the cloud | AI handles even 100MB-class workbooksIn Samurai App, AI reads even 100MB-class Excel files in a cloud runtime and returns the aggregated or reshaped results as files. Workbooks up to 25MB open for editing in a spreadsheet view in the browser, and charts and macros stay in the original file.

More in this category

Back to Productivity articles

Everyday work comes together, connects, and becomes the company's strength.

Contact usOpen Samurai App

See the demoContact us