Do Excel Macros Work in Microsoft 365 and Excel Online?
Question details
The user wants to know if legacy Excel VBA macros are compatible with Microsoft 365 and Excel Online, and how to enable them.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Attempting to run or enable VBA macros in modern Microsoft 365 desktop apps or Excel for the web.
- Observed behavior
- Users need clarity on macro compatibility, as macros run on desktop versions but are unsupported in the web browser version.
Ensure your Excel file is saved in a macro-enabled format (.xlsm) and verify that the file originates from a trusted source before enabling any macros.
Enable and Run Macros in Microsoft 365 Desktop Apps
VBA macros are fully supported in the desktop versions of Excel for Windows and Mac included with Microsoft 365.
Microsoft 365 desktop applications continue to support legacy VBA macros. However, for security reasons, macros from the internet are often disabled by default. You must save the file correctly and adjust your Trust Center settings to run them.
Launch the Microsoft 365 desktop version of Excel and open your workbook.
Go to 'File' > 'Save As' and ensure the file format is set to 'Excel Macro-Enabled Workbook (*.xlsm)'.
Navigate to 'File' > 'Options' > 'Trust Center' and click the 'Trust Center Settings' button.
Select 'Macro Settings' from the left pane, choose 'Enable VBA macros' (only if you trust the file source), and click 'OK'.

Handling Macros in Excel for the Web (Excel Online)
VBA macros cannot be executed in the web browser version of Excel.
Use WPS Spreadsheet to Run Excel VBA Macros
WPS Office provides robust support for VBA macros in its desktop application. You can seamlessly open your .xlsm files, edit macro code, and run your automated tasks without complex configurations.
- 1. Install WPS Office: Download and install WPS Office on your computer.
- 2. Open your Macro File: Open WPS Spreadsheet and go to 'Menu' > 'Open' to select your .xlsm file.
- 3. Access Developer Tools: Click on the 'Developer' tab in the top ribbon.
- 4. Run Macros: Click 'Macros' to view, run, or edit your VBA scripts instantly.

Frequently Asked Questions
Can I use Office Scripts instead of VBA in Excel Online?
Yes, Microsoft 365 offers Office Scripts as a modern, cloud-friendly alternative to VBA. Office Scripts use TypeScript and can be recorded and run directly in Excel for the web.
Why is the 'Enable Content' button not appearing for my macro in Microsoft 365?
If the file was downloaded from the internet, it might be blocked by Windows Mark of the Web (MOTW) security. You need to right-click the file in Windows File Explorer, select 'Properties', check the 'Unblock' box at the bottom, and click 'Apply'.
Will my older .xls macros work in Microsoft 365?
Yes, Microsoft 365 desktop apps can still run macros from older Excel 97-2003 (.xls) files. However, it is highly recommended to save them in the newer .xlsm format for better security and stability.
Does WPS Office Free support VBA macros?
VBA macro support in WPS Office is available depending on your region and software version. In many regions, you may need to install a specific VBA module or upgrade to WPS Pro to fully utilize advanced macro features.




