Fix Excel VBA Macros Not Working After Uploading to OneDrive
Question details
Users are unable to run Excel VBA macros after uploading their workbooks to OneDrive and opening them in the browser.

- Product
- Microsoft Excel, OneDrive
- Device & OS
- not provided
- Scenario
- Attempting to execute VBA macros in an Excel workbook hosted on OneDrive or accessed via Excel for the Web.
- Observed behavior
- The VBA macros do not run or trigger errors because browser-based Excel environments do not support desktop VBA execution.
Verify that your workbook is saved in the .xlsm (Macro-Enabled Workbook) format before proceeding with these solutions.
Open the Workbook in the Excel Desktop Application
The quickest way to run your macros is to bypass the web browser and open the file directly in the desktop app, which fully supports VBA.
Excel for the Web does not support the execution of VBA macros. To utilize your existing VBA code, you must launch the file using the full desktop version of Excel.
Navigate to your OneDrive and open the macro-enabled workbook in your web browser.
Click on the 'Viewing' or 'Editing' dropdown menu on the top ribbon, and select 'Open in Desktop App'.
Once the file opens in the Excel Desktop application, click 'Enable Content' in the yellow security warning bar at the top to allow your macros to run.

Convert VBA to Office Scripts for Web Automation
If you must run automation strictly within the web browser, consider rewriting your macros using Office Scripts.
Seek Help in VBA Developer Communities
If your macros have complex dependencies or need to be adapted for modern cloud workflows, consulting developer forums can help.
Try WPS Office for Seamless VBA Macro Execution
If you are frustrated by macro limitations in browser-based tools, switch to WPS Office. It provides a lightweight, highly compatible desktop environment that fully supports Microsoft Office formats and VBA macros without forcing you into restrictive cloud environments.
- 1. Download WPS Office: Visit the official WPS website to download and install the free desktop suite on your computer.
- 2. Open Your Workbook: Launch WPS Spreadsheets and open your .xlsm file directly from your local drive or synced folder.
- 3. Enable Macros: Click 'Enable Macros' if prompted by the security warning, and run your VBA scripts seamlessly.

Frequently Asked Questions
Why do my VBA macros work on my desktop but not on OneDrive?
VBA macros rely on the local desktop operating system's architecture to execute code. Excel for the Web, which is used when opening files from OneDrive in a browser, does not have the underlying framework to process VBA.
Can I run macros in Excel for the Web at all?
No, Excel for the Web cannot run standard VBA macros. You must either open the workbook in the desktop version of Excel or rebuild your automation using Office Scripts, which is supported in the browser.
Will I lose my macros if I upload the file to OneDrive?
No, uploading a macro-enabled workbook (.xlsm) to OneDrive does not delete the macros. They remain safely stored inside the file; they simply cannot be executed while you are viewing the file in the web browser interface.




