Detect if doc is already open in VBA

K

kiln

I have a code routine that runs from MS Access 2000 that moves word docs
to a different folder pepending on various factors. I'd like to be able
to tell if a doc is already open; if it is, I'd have the routine skip
the move attempt. Probably trapping for an error would work, but is
there a property etc that can be diretctly interrogated for this?
 
J

Jezebel

Get a reference to the Word application, then examine the Documents()
collection --

Dim pDoc as Word.Document

For each pDoc in WordApp.Documents
if pDoc.Name = [Filename] then
... yes it's open
 
K

kiln

Perfect, thanks!

Get a reference to the Word application, then examine the Documents()
collection --

Dim pDoc as Word.Document

For each pDoc in WordApp.Documents
if pDoc.Name = [Filename] then
... yes it's open



kiln said:
I have a code routine that runs from MS Access 2000 that moves word docs
to a different folder pepending on various factors. I'd like to be able
to tell if a doc is already open; if it is, I'd have the routine skip
the move attempt. Probably trapping for an error would work, but is
there a property etc that can be diretctly interrogated for this?
 

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