Support Portal

for ProcessRobot and WinAutomation

Start a new topic

Work with already open Excel

We have a program that generates/opens Excel.

How de we get that, already open, Excel into an Excelinstance that WinAutomation can work with ?

Best Answer

Use Attach to Running Excel - action and it attached by excel file name.


Use Attach to Running Excel - action and it attached by excel file name.

So I tried to attach it with the wildcard method "*Excel" but: "No Excel Document found named as *Excel" although it is open and it is the only worksheet that is open. 

I'm running on Windows 10, Office 365 Pro Plus

The Attach actions does not accept wild cards, so you need to specify he full path to the Excel File.

So how to does the Attach Actions attach to an already running excel document that was exported from a 3rd party system and can't be located in a download folder?

Does the action accept variables in the path?


yes, you can include variables in the path

it is generally better to use a set variable action before and specify the full path to the excel file there to make it easy to debug and view what values were substituted into the variables and the path name.

Example 1:

1. Set  %ExcelDoc% = ExcelFileName.xlsx

2. Attach to Excel

Action input
Document Name:     C:\Users\Desktop\Username\\%ExcelDoc%
 .... Note:  \\ before variable; name, else a \% (a backslash before a %) means you are specifying the literal % symbol and not start of a variable.

Example 2:

1. Set  %ExcelDoc% = ExcelFileName.xlsx

2,  Set %ExcelPath% =  C:\Users\Desktop\Username\\%ExcelDoc%

3. Attach to Excel

Action input
Document Name:  %ExcelPath% 

New problem :-)
Any hints to getting the document name from the running Excel ?
My download generates a random filename.

Can you find the windows temp folder path where it downloaded the excel for opening ?
Follow this to add full path to excel toolbar. Once you now folder path you can use get file in folder action to get excel full path to attach to....

Yes I can find the temp folder.
I just don't know which excel-file I need.

Is there more than the 1 excel file in the temp download folder or only the 1 excel file ?

Yes there is several. The program we uses has its own "temp" folder and uses it for a lot of filehandling.

BUT in the meantime I has found a solution :-)

1. Get Window - Where the control doesn't look at the filename (basically just look for a running Excel)

2. Get details og Window - Can return the titel of the window

3. Attach To Running Excel - and i'm good to go

Leif, excellent solution.

Hi Leif,

Do you mind sharing the program name you use? 

As I am running into this issue as well and have trouble attaching to the running excel as the file name changes when downloading.

Appreciate it!

Login or Signup to post a comment