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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Is it possible to crea...
Power Automate
Answered

Is it possible to create an Excel instance by selecting an open Excel worksheet using a file dialog?

(0) ShareShare
ReportReport
Posted on by 9

Hi experts,

I'd like to be able to select an open excel workbook from a file dialog in order to create an instance of it. Having to close it and launch it via Power Automate is quite time consuming. I find the custom forms to be a bit too basic in PAD. Is there a way to customize the file dialog so that it selects/saves the file name instead of opening it? Or are there any other workarounds to prevent having to close and relaunch the selected excel file?

 

Thanks!

Yaro_0-1669928717577.png

I have the same question (0)
  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    There is an “Attach to Excel” action for already opened excel files. 

    good luck!

  • Yaro Profile Picture
    9 on at

    Hey Michael,

    I'm aware of attach to excel, however, for my use case, the user would most likely already have the excel file open and it would be a different file every time, so it would be best and most reliable if the user is allowed to select the file using a file dialog, I don't want to make them type the exact name of the excel file into a textbox. I feel like this functionality should be possible?

  • Verified answer
    VJR Profile Picture
    7,635 on at

    Hi @Yaro 

    I've written a vbscript to read all the open workbooks and display it in a Listbox.

     

    VJR_0-1670039715945.png

     

    Copy paste the below code in a blank Flow editor and test the Flow.

     

    Scripting.RunVBScript VBScriptCode: $'''Dim wkb, objXL 
    On error resume next
    Set objXL = GetObject (, \"Excel.Application\")
    
     For Each wkb In objXL.Workbooks		
     strMessage = strMessage & wkb.FullName & \"|\"
     Next
    	
    set objXL = nothing
    Wscript.Echo strMessage''' ScriptOutput=> VBScriptOutput
    Text.SplitText.SplitWithDelimiter Text: VBScriptOutput CustomDelimiter: $'''|''' IsRegEx: False Result=> TextList
    Variables.RemoveItemFromList.RemoveItemFromListByIndex ItemIndex: TextList.Count - 1 List: TextList
    Display.SelectFromListDialog.SelectFromList Title: $'''Excel File selection''' Message: $'''Please select a file''' List: TextList IsTopMost: False AllowEmpty: False SelectedItem=> SelectedItem SelectedIndex=> SelectedIndex ButtonPressed=> ButtonPressed
    

     

     

    The user still has a chance to select an incorrect file if more than one are already opened but I believe this is what you wanted.

     

    You need to add your own validation for scenarios where no Excel files are already opened on the system.

  • Yaro Profile Picture
    9 on at

    Wow, this is brilliant! Many thanks @VJR 

  • Zicco Profile Picture
    15 on at

    It does't work for me.

    I'm using Power Automate for Desktop

     

    image.png

  • JLSmith Profile Picture
    3 on at

    Fantastic solution 👍

    Don't know why but I had to change the first part from Scripting.RunVBScript to Scripting.RunVBScript.RunVBScript though otherwise the first step was not recognised by Power Automate.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 167

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard