How to get the running word/excel application object?

Jun 14, 2011 at 2:34 PM
Edited Jun 14, 2011 at 2:35 PM

It seems that the examples for word/excel always create a new application object.

How to get the running application object?

Jun 15, 2011 at 6:43 PM
Edited Jun 15, 2011 at 6:43 PM

excel holds open workbooks in running object table.
word holds application and open documents in running object table.
Examples\Misc\GetRunningOutloukInstance.sln demonstrate to accsessing a runnng object from ROT(running object table)
i do examples for other office applications very soon.
create an issue if you want.

best wishes


Jul 6, 2011 at 10:30 AM

You need to be careful when using the Application reference from the ROT, particularly when you are running as an add-in inside the office application. The instance registered in the ROT will refer to the last instance of the application that was started, which might differ from the instance you are actually running in.

The right way to get the Application instance from within your add-in (if you didn't store the instance in Connect) is to get a window handle for your instance, then call AccessibleObjectFromWindow(..). There is some useful discussion here: and here:


Excel-DNA - Free and easy .NET for Excel

Jul 6, 2011 at 11:04 AM
Edited Jul 6, 2011 at 11:05 AM

 partially right, different office applications do different things. for example outlook can be started one time and its easy to get application object from ROT.
excel stores all open workbooks to ROT and not the application object but you can get the application object from the worbook proxy.
anyway, a COMAddin has to use the Connect function from IDTExtensiblity2 of course to get the application proxy.
*best regards