L
Lars Brownies
From within MS Access I'm trying to determine if a particular Word document
is already opened. If it is, I want to bring the document to the front,
otherwise I just want to open the document. I have the following test code:
Dim oApp As Object
Dim objDocument As Object
Set oApp = CreateObject(Class:="Word.Application")
For Each objDocument In oApp.Documents
If objDocument.Name = "MyFile.doc" Then
debug.print "Found"
End If
Next objDocument
However, this only works if I add extra code right after the:
Set oApp = CreateObject(Class:="Word.Application")
This extra code opens the Word-document.
If I open the Word document manually and then run the code, it won't notice
that the
document is already open. Is it possible to assign the already opened
documents to
oApp.Documents collection? Or is there another way to do what I want.
Thanks,
Lars
is already opened. If it is, I want to bring the document to the front,
otherwise I just want to open the document. I have the following test code:
Dim oApp As Object
Dim objDocument As Object
Set oApp = CreateObject(Class:="Word.Application")
For Each objDocument In oApp.Documents
If objDocument.Name = "MyFile.doc" Then
debug.print "Found"
End If
Next objDocument
However, this only works if I add extra code right after the:
Set oApp = CreateObject(Class:="Word.Application")
This extra code opens the Word-document.
If I open the Word document manually and then run the code, it won't notice
that the
document is already open. Is it possible to assign the already opened
documents to
oApp.Documents collection? Or is there another way to do what I want.
Thanks,
Lars