Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2005

Tip: Looking for answers? Try searching our database.

When can I be sure my Word doc is really closed?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hal Tz - 10 Aug 2005 20:30 GMT
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
Cindy Meister - 11 Aug 2005 07:45 GMT
What are the chances that the user has saved it to a different location
(File/Save As)?

 -- Cindy

> I have a VB app that opens a doc in Word, then hangs around waiting for it to
> close, calling this periodically:
[quoted text clipped - 24 lines]
> -
> Hal
Hal Tz - 11 Aug 2005 14:32 GMT
none..these are my testers, and they don't vary from the script, which says
to always save the file with the same path and name.
Signature

Hal

> What are the chances that the user has saved it to a different location
> (File/Save As)?
[quoted text clipped - 29 lines]
> > -
> > Hal
Cindy Meister - 11 Aug 2005 14:59 GMT
> none..these are my testers, and they don't vary from the script, which says
> to always save the file with the same path and name.

<sigh> It can never be the obvious, easy answer, can it? (Or if it is, one
doesn't ask the question, so it goes round in circles because of that.)

FWIW, the only time I've ever seen anything even resembling what you report
is when  user has opened a file directly from, say, an Outlook email message.
They'll work, save assiduously, close... and all the changes are lost,
because the file they were saving to was a TEMP file that was destroyed when
the document was closed. (This, from personal experience living in a
household with someone who's a durn good beta tester - can break anything
without even trying.)

Other than that, there's been the occasional "murmer" here in the NGs where
users have complained on occasion that this is happening. Unfortunately, I
can't recall the Windows+Word combination where that was happening (if those
people ever did respond and tell us). But those reports were very few, and
very far between...

If you're seeing this consistently, though, then I have to suspect something
in how your application is working with Word, or a system configuration
problem. Some kind of "management" software or anti-virus software, for
example, that might be interfering with the file management. Is there
anything of this nature installed? If you boot a system where this is
happening all the time in Safe Mode, does it still occur?

 -- Cindy

> > What are the chances that the user has saved it to a different location
> > (File/Save As)?
[quoted text clipped - 29 lines]
> > > -
> > > Hal
Hal Tz - 11 Aug 2005 15:27 GMT
thanks for the thoughts..it will take quite a while to eliminate other apps
as potential culprits, and also to get the machines where this is happening
OCCASIONALLY (darn!) into Safe Mode. I'll get back to you. Thanks again!
Signature

Hal

> > none..these are my testers, and they don't vary from the script, which says
> > to always save the file with the same path and name.
[quoted text clipped - 58 lines]
> > > > -
> > > > Hal
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.