This project has moved and is read-only. For the latest updates, please go here.

How can I connect to the current instance of an application by the file name?

Apr 28, 2014 at 8:15 AM
Edited Apr 29, 2014 at 1:05 AM
Is it possible to use something like GetObject("c:\path\sample.mdb") to set the, for example, an Access.Application object? The "ACC: Using Microsoft Access as an Automation Server" article ( describes what I am trying to accomplish.

Overall, this is a pretty amazing way to perform Office Automation.


Apr 30, 2014 at 1:08 AM
its possible, but you have no warranties to access a specific appliaction. (GetObject use the first instance in the ROT(Running Object Table)) The given examples show you this. Please explain whats your problem in detail. You want access an accesss app by (mdb)filename?
Jun 22, 2014 at 11:21 PM

I'm also very much interested in this.

I'm writing a companion product for Word. (but not a plugin).

From the companion app, I need to find Word instance of a given filename.

But it doesn't seem to work.

If I have 3 word instances open, and I do this:
                foreach (Application word_application in Application.GetActiveInstances())
                    foreach (Window window in word_application.Windows)
                        if (filename == window.Document.FullName)
                            //Do good stuff here

it doesn't work.

Application.GetActiveInstances() returns 3 applications,

but window is always the same, first instance.

How can I get to the file I need?

Many thanks.