Can Power Automate Use Excel Macro-Enabled XLSM Files?
Question details
The user wants to know if Microsoft Power Automate can execute VBA macros stored in an Excel macro-enabled (XLSM) file, as their flow stopped working after converting the workbook format.

- Product
- Microsoft Excel and Power Automate
- Device & OS
- not provided
- Scenario
- Running an automated workflow in Power Automate to update or interact with an Excel workbook that contains VBA macros.
- Observed behavior
- The Power Automate flow fails or stops running because VBA macros contained in XLSM workbooks cannot be natively executed through Power Automate.
Verify if your Power Automate flow explicitly requires executing the macro to function, or if it only needs to perform standard data reading and writing operations on Excel tables.
Replace VBA Macros with Office Scripts
Since Power Automate cannot execute VBA, rewrite your automated tasks using Office Scripts, which are fully supported by cloud flows.
Microsoft Power Automate is designed to work with cloud-based technologies and does not support the execution of local VBA macros. To maintain automation, you must transition your VBA code into Office Scripts.
Upload your workbook to OneDrive or SharePoint, and open it using Excel for the Web or a compatible Excel desktop version.
Navigate to the 'Automate' tab on the ribbon and click 'New Script' or 'Record Actions' to recreate your VBA logic in TypeScript.
Save your Office Script to your cloud storage so that it is accessible to your Power Automate environment.
In your Power Automate flow, add the 'Run script' action under the Excel Online (Business) connector and select the script you just created instead of attempting to trigger a VBA macro.

Revert to a Standard XLSX Workbook
If you do not strictly need to run the macro within the automated flow, revert your file to a standard XLSX format to prevent execution errors.
Experience Lightweight and Compatible Spreadsheet Management with WPS Office
While Power Automate has strict limitations with Microsoft Excel VBA macros, managing complex spreadsheets doesn't have to be frustrating. WPS Office provides a free, lightweight, and highly compatible alternative that perfectly supports your Excel files and offers a familiar interface for seamless daily work.
- 1. Download WPS Office: Visit the official WPS website to download the free installation package for your operating system.
- 2. Install the Suite: Follow the on-screen instructions to quickly install WPS Office and open WPS Spreadsheet.
- 3. Open Your Spreadsheets: Simply open or drag and drop your existing Excel files into WPS to continue your data processing seamlessly.

Frequently Asked Questions
Why does my Power Automate flow fail with XLSM files?
Power Automate natively blocks the execution of VBA macros stored in XLSM files due to security policies and architectural differences between desktop VBA and cloud-based automation.
Can Power Automate read data from an XLSM file without running the macro?
Yes, Power Automate can read and write data to formatted tables inside an XLSM file, provided the flow relies exclusively on standard data connector operations and does not attempt to trigger the VBA macro.
Are Office Scripts better than VBA for automation?
For cloud-based automation like Power Automate and Excel for the Web, Office Scripts are strictly required. However, VBA remains a powerful and widely used tool for local, desktop-bound macro execution.




