H
Hal Tz
I have a VB app that opens a doc in Word, then hangs around waiting for it to
close, calling this periodically:
------------------------------------------------------------
(oWD is Word.Application, already instantiated )
Function IsDocOpen (sName as string) as Boolean
Dim doc As Document
IsDocOpen = False
For Each doc In oWD.Documents
If (InStr(sName, doc.Name)) Then
IsDocOpen = True
GoTo endit
End If
Next doc
endit:
end function
------------------------------------------------------------
Once the file is closed, I need to copy the (potentially) modifed file
elsewhere. IsDocOpen works fine, but there are occasional instances (never
on my machine, of course) where the copy yields the old version of the file.
I'm guessing the file is not really closed yet when Word says it is. I've put
plenty of debug statements everywhere but have come up empty. I have also
(just today, I have no results yet), put in a call to a C++ function that
uses CFile to open the file exclusively, which in a simple test program fails
if word has it open and suceeds if not. Wondering if anyone had any other
ideas. Thanks.
-
Hal
close, calling this periodically:
------------------------------------------------------------
(oWD is Word.Application, already instantiated )
Function IsDocOpen (sName as string) as Boolean
Dim doc As Document
IsDocOpen = False
For Each doc In oWD.Documents
If (InStr(sName, doc.Name)) Then
IsDocOpen = True
GoTo endit
End If
Next doc
endit:
end function
------------------------------------------------------------
Once the file is closed, I need to copy the (potentially) modifed file
elsewhere. IsDocOpen works fine, but there are occasional instances (never
on my machine, of course) where the copy yields the old version of the file.
I'm guessing the file is not really closed yet when Word says it is. I've put
plenty of debug statements everywhere but have come up empty. I have also
(just today, I have no results yet), put in a call to a C++ function that
uses CFile to open the file exclusively, which in a simple test program fails
if word has it open and suceeds if not. Wondering if anyone had any other
ideas. Thanks.
-
Hal