Hi all,
Trying to create a new flow to run a macro in an xlsm file saved to OneDrive for Business
Following instructions here
Getting this error:
The dynamic operation request to API 'excelonlinebusiness' operation 'GetSingleScript' failed with status code 'BadRequest'. This may indicate invalid input parameters. Error response: { "status": 400, "message": "Unable to parse script reference. clientRequestId: d450df0a-ca31-4283-bb5d-0c1ebddc6ebd", "error": { "message": "Unable to parse script reference." }, "source": "excelonline-scus.azconn-scus-001.p.azurewebsites.net" }
What am I doing wrong?
Thanks,
-w
Hello @wsnyder ,
The "Run script" action will only run the "Office Scripts" you have recorded/created in Excel for the web and stored on your OneDrive for Business. You can indeed run an Office Script against a *.xlsm workbook that contains VBA macros, but it won't run the VBA code in that workbook.
Unfortunately, we won't be able to run VBA macros with Power Automate. And I agree with you, Office Scripts is quite different from VBA. Here are some Differences between Office Scripts and VBA macros - Office Scripts | Microsoft Learn, if that helps.
Some .xlsm files, especially those with ActiveX or Form controls, may not work in the Excel online connector. Be sure to test before deploying your solution.
Bump.
Any thoughts?
Thanks,
-w
Ah I had no clue they were different - I am out of my element here, I will let another expert step in. Thanks for the link!
Thanks,
The documentation seem to be dealing with Scripts created in Office Script - that is a totally different beast altogether.
I am trying to call an xlsm file saved to OneDrive for Business location and calling a VBA SubProcedure in that file. Documentation is found here for all of the steps I am following
Thank you for posting your script.
I'm not super familiar with VBA, but I noticed that when I put this into my workbook, it didn't show up in the dropdown - so I started looking into limitations of the script action.
https://docs.microsoft.com/en-us/office/dev/scripts/develop/power-automate-integration
It seems like it needs to be a main function, and, you have to call ExcelScript.Workbook as the first ...thing.
Here is VBA:
Option Explicit
Sub foo()
Dim wb As Workbook
Dim ws As Worksheet
Set wb = ThisWorkbook
Set ws = wb.Worksheets(1)
ws.Cells(2, 2) = "Demo"
ws.Cells(3, 2) = 1
ws.Cells(4, 2) = 2
Set ws = Nothing
Set wb = Nothing
End Sub
What else can I show beyond the error message and the screenshot of the flow?
Hard to say.. are you able to show us what your script looks like?
Michael E. Gernaey
497
Super User 2025 Season 2
David_MA
436
Super User 2025 Season 2
Riyaz_riz11
244
Super User 2025 Season 2