How To Determine Document Is Open

U

Umpty

Within Word is there a way to determine if a document is open or not. I am
trying to do something like this :

If ("MyFile.doc" or any articular file is open) then
do something
else
Set oApp = New Word.Application
oApp.Documents.Open CurrentProject.Path & "\MyFile.doc"
oApp.Visible = True
End If

Is there an IsOpen command or similar available?
 
M

Malcolm Smith

Best thing to do is to rattle through the Documents collection to see if
the document is open.

Best done in a nice little function returning a boolean.

- Malc
 
B

Bo Hansson

Here is one way:

For Each aDoc In Documents
If aDoc.Name = "DocName.doc" Then
MsgBox "Document DocName.doc is open."
Exit For
End If
Next

/BosseH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top