web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : ymv+J9D7KgVHUVpl8TGXzK
Power Automate - General Discussion
Unanswered

Flow To Run Script In XLSM File

Like (0) ShareShare
ReportReport
Posted on 29 May 2022 20:41:51 by 8

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" }

flow_error.png

What am I doing wrong?
Thanks,

-w

  • Yutao Huang Profile Picture
    Microsoft Employee on 02 Nov 2022 at 15:41:41
    Re: Flow To Run Script In XLSM File

    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.

  • David_Lebosse Profile Picture
    2 on 25 Oct 2022 at 12:19:40
    Re: Flow To Run Script In XLSM File

    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.

  • wsnyder Profile Picture
    8 on 31 May 2022 at 14:37:24
    Re: Flow To Run Script In XLSM File

    Bump.
    Any thoughts?

    Thanks,
    -w

  • Rhiassuring Profile Picture
    8,688 Moderator on 30 May 2022 at 19:34:45
    Re: Flow To Run Script In XLSM File

    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!

  • wsnyder Profile Picture
    8 on 30 May 2022 at 18:14:11
    Re: Flow To Run Script In XLSM File

    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

  • Rhiassuring Profile Picture
    8,688 Moderator on 30 May 2022 at 17:38:36
    Re: Flow To Run Script In XLSM File

    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.

  • wsnyder Profile Picture
    8 on 30 May 2022 at 16:04:25
    Re: Flow To Run Script In XLSM File

    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

  • wsnyder Profile Picture
    8 on 30 May 2022 at 14:56:45
    Re: Flow To Run Script In XLSM File

    What else can I show beyond the error message and the screenshot of the flow?

  • Rhiassuring Profile Picture
    8,688 Moderator on 30 May 2022 at 05:13:47
    Re: Flow To Run Script In XLSM File

    Hard to say.. are you able to show us what your script looks like?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete