How to Run Excel VBA Macros Automatically in the Cloud
Question details
A company wants to know if they can schedule an Excel VBA macro to run automatically at a specific time (e.g., 4:00 a.m.) after moving the workbook to cloud storage with co-authoring enabled.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Automating daily data updates within a macro-enabled Excel workbook hosted in a cloud environment so external systems can retrieve the processed data each morning.
- Observed behavior
- Excel for the web and server-side cloud storage do not natively support or execute VBA macros. Running automated tasks requires either a local desktop environment or modern cloud alternatives like Office Scripts.
Before configuring your automated tasks, verify that your Microsoft 365 subscription includes access to Power Automate and Office Scripts, or ensure you have a dedicated, always-on local computer if you plan to continue using legacy VBA.
Migrate to Office Scripts and Power Automate (Cloud-Native)
Since VBA does not run natively in Excel for the web, replacing your VBA code with Office Scripts and scheduling it via Power Automate provides a true server-side cloud solution.
Office Scripts use TypeScript and are designed specifically for Excel on the web. Once your script is created, Power Automate can trigger it on a precise schedule without requiring a computer to remain powered on.
Open your workbook in Excel for the web. Navigate to the Automate tab on the ribbon, select 'New Script', and rewrite your VBA logic into the TypeScript editor. Save the script.
Log into Microsoft Power Automate and click 'Create' from the left menu. Choose 'Scheduled cloud flow', name your flow, and set the starting time and daily recurrence (e.g., 4:00 a.m.).
Click 'New step' and search for 'Excel Online (Business)'. Select the 'Run script' action. Choose the cloud location (e.g., OneDrive or SharePoint), select your workbook, and pick the Office Script you just created.
Save and test the flow. Finally, update any external systems to retrieve data using Microsoft Graph APIs or the correct SharePoint/OneDrive file identifiers instead of legacy local network paths.

Schedule Execution via Dedicated Desktop Automation
If rewriting complex VBA code into Office Scripts is not feasible, you can keep the workbook in the cloud but use a local Windows machine to trigger the macro automatically.
Use WPS Office for Reliable Desktop Macro Execution
While cloud-native VBA execution is unsupported in Microsoft 365 without complicated workarounds, WPS Office provides a lightweight, cost-effective desktop alternative with powerful built-in VBA support. Easily run your legacy automated macros locally without the overhead.
- 1. Download and Install WPS Office: Visit the official WPS Office website and install the free software suite on your desktop computer.
- 2. Open Your Macro-Enabled File: Launch WPS Spreadsheets and open your .xlsm file. The familiar interface will allow you to access your existing data immediately.
- 3. Enable and Run Macros: Navigate to the Developer tab, enable macros, and utilize your traditional VBA scripts natively without requiring complex cloud conversions.

Frequently Asked Questions
Why doesn't Excel for the web support VBA macros?
Excel for the web operates on standard web technologies (HTML/JS) and does not have the underlying architecture to run Visual Basic for Applications natively. Microsoft instead provides Office Scripts for web-based automation.
Can external systems access a co-authored Excel file in the cloud?
Yes, external systems can access cloud-hosted Excel files by using Microsoft Graph API connections or proper SharePoint/OneDrive file identifiers, which is much more reliable than relying on legacy local drive paths.
Will my existing VBA code work automatically in Office Scripts?
No. VBA uses Visual Basic, whereas Office Scripts are based on TypeScript. You will need to rewrite or translate your macro logic into an Office Script before it can be scheduled in the cloud via Power Automate.
Can I use Windows Task Scheduler to run cloud macros?
Windows Task Scheduler cannot directly trigger macros on a cloud server. However, you can use it on a local PC to open a cloud-synced workbook via the desktop Excel application and execute the local macro from there.




