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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Is there a way to get ...
Power Automate
Answered

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

(0) ShareShare
ReportReport
Posted on 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?

I have the same question (0)
  • VJR Profile Picture
    7,635 on at

    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

     

  • Verified answer
    MichaelAnnis Profile Picture
    5,727 Moderator on at

    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!

  • Kreginaw Profile Picture
    6 on at

    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?

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    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. 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard