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 : 0qUgBiLIqZCicOWUkBdD+5
Power Automate - Power Automate Desktop
Answered

Is there a way to get an existing instance without using PAD to launch?

Like (0) ShareShare
ReportReport
Posted on 27 Apr 2022 13:46:21 by 6

I am relatively new to automation with PAD, so I do not know if this is even possible. I've scoured and have not found a definitive answer to the following:

 

If I have an existing instance of Excel open outside of PAD, is there a way to grab that instance to use for flows? The reason I ask this is because I am running into a problem that I really hope has a simple solution, described below.

 

I use Office 365 (desktop application) for a spreadsheet report for work. When I need to update the reports, I use our software to export the data to Excel and then use macros to copy and assess differences between the two reports. While I can do all of this by opening the report sheet and exporting the new data, I am diving into using PAD to grab information from the report sheet and automating some other tasks, including selecting the active cell and gathering information for emails, account updates, etc.

 

If I use PAD to open up the report workbook, it naturally creates an Excel instance, and it's no problem to do what I need to do using PAD. However, if I export data, it is in a separate Excel instance and I no longer can use my macros to cycle through the workbooks since it is now two separate instances. The only workaround I have for it is when I want to update reports, I close out the PAD-generated one, open it manually, export the data I need, run my macros, close the workbooks, then open again with PAD. I'd really like to skip all those steps. Is there any hope for this?

Categories:
  • MichaelAnnis Profile Picture
    5,721 Moderator on 29 Apr 2022 at 02:58:16
    Re: Is there a way to get an existing instance without using PAD to launch?

    you marked as solution, so I’m sure you got it working, but I will answer your question because it is pertinent to those having similar issues. 

    If you download an Excel file, and it opens to a temp folder, hopefully it is the focused window. If so, you can use “Get Window Details” and use “the focused window” as the window selection. Once you get the title using that action, you can use the title (or window instance) to attach to it. 

    option 2…if you really don’t want to save it first, make sure your macro workbook is closed…if the new excel is the focused window, get the title same as above, and then use the UI to File Open Browse, navigate to and open the macro workbook, attach to excel back to the exported workbook and run your macro. It skips the small step of having to save that workbook by using the already open workbook to open the macro workbook rather than the other way around. Ultimately, you just need to be sure you are using one to open the other and not PAD to open both, so you have access to the macros. 

    best of luck. 

  • Kreginaw Profile Picture
    6 on 28 Apr 2022 at 16:13:37
    Re: Is there a way to get an existing instance without using PAD to launch?

    A couple downsides to this, I think, but it is more a "me" problem than a community problem.

     

    1. The exported file opens up as a temp file since it directly opens up in Excel. However, the file name is not consistent. It has a leading set of digits that is never the same and not tied to anything I can imagine. The rest of the file name is static, though. For example:

     

    First export: 2424818_Report_JT.xml

    Second export: 432814_Report_JT.xml

     

    Having to save it is an extra step that I was hoping to avoid, but in all honesty, it's nothing to delete the file after I gather the info I need. In fact, I imagine I can set up a flow to do all the above, then have the flow run the macro and delete the file after its use is up.

     

    Are there any complications I may run into, or a better way to handle it?

  • Verified answer
    MichaelAnnis Profile Picture
    5,721 Moderator on 28 Apr 2022 at 03:11:43
    Re: Is there a way to get an existing instance without using PAD to launch?

    So @VJR is right on step 1.  Attach to Excel will let you manipulate the new file; however, you still need that file in your instance to run the macros. 

    After exporting, attach to excel, save the file as

    then, attach to your macro workbook

    use click on window elements for File > Open > Browse

    wait for text field “FileName”

    send keys %Directory%{Enter} where directory is the folder address for the file you just saved
    Send keys %Filename%{Enter}

    doing this will open the file in the same instance. Once it is open, attach to it again, and now you can use the macros in it. Good luck!

  • VJR Profile Picture
    7,635 on 28 Apr 2022 at 02:55:27
    Re: Is there a way to get an existing instance without using PAD to launch?

    Hi @Kreginaw 

     

    You can use "Attach to running Excel".

     

    When you select the below dropdown it will automatically show you the list of available Excel files already open on your machine or you can give a variable.

     

    VJR_0-1651114457126.png

     

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