Access all documents for Word from multiple instance using Excel VBA

47 views Asked by At

There are multiple instances of word running in my machine. I require list for all documents from all the instances. Say Instance 1 has document open name: "Document 1" and instance 2 has document open name: "instance2.docx"

I am looking for both "Document 1" and "instance2.docx"

But when I use below code it returns the documents present in first instance ie(only "Document 1")

Set oApp = GetObject(, "Word.Application") // this returns the object of first instance only
For Each X In oApp.Documents 
MsgBox X.Name    // will give only document "Document 1"
Next X 

Closing word application from Excel VBA -- checked this but here we need to close the first instance in order to get details of next one.

Is there any way we can access all the documents without closing the instances?

0

There are 0 answers