logo
search
VBA & Macro Problems

Can Power Automate Use Excel Macro-Enabled XLSM Files?

Phi Hung VoPhi Hung Vo Oct 19, 2026 869 views

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.

Can Power Automate Run Excel Macro-Enabled XLSM Files?
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.
Before you start

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.

Solution 1Recommended

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.

1
Open your Excel Workbook on the Web

Upload your workbook to OneDrive or SharePoint, and open it using Excel for the Web or a compatible Excel desktop version.

2
Create an Office Script

Navigate to the 'Automate' tab on the ribbon and click 'New Script' or 'Record Actions' to recreate your VBA logic in TypeScript.

3
Save the Script

Save your Office Script to your cloud storage so that it is accessible to your Power Automate environment.

4
Update the Power Automate Flow

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.

Replace VBA Macros with Office Scripts
Cloud Compatibility: Office Scripts are specifically built for cross-platform and cloud automation, making them the standard replacement for VBA in Power Automate.
Free Microsoft Office alternative

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. 1. Download WPS Office: Visit the official WPS website to download the free installation package for your operating system.
  2. 2. Install the Suite: Follow the on-screen instructions to quickly install WPS Office and open WPS Spreadsheet.
  3. 3. Open Your Spreadsheets: Simply open or drag and drop your existing Excel files into WPS to continue your data processing seamlessly.
Fully compatible with Microsoft Excel .xlsx and .xlsm formatsLightweight design ensures fast loading and smooth operationFamiliar tabbed user interface requires no extra learning curveFree to use with comprehensive spreadsheet, document, and presentation capabilities
microsoft office alternative - wps office

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.