Click to See Complete Forum and Search --> : delayed access to file saved by word macro


Lothar Haensler
February 9th, 2000, 08:46 AM
In my Word macro I save a file in RTF format by using the FileSaveAs statement in Wordbasic.
After that I want to inform my VB app via BroadcastSystemMessage.
This works most of the time.
But sometimes, when the VB app tries to access the RTF file, it is not there yet.
Only when the VB app waits for a few milliseconds can it safely acccess the RTF file.

It seems as if the FileSaveAs routine returns before the file has been completely written.
I have a theory that FileSaveAs runs in a separate thread. (OTOH, most theories that make sense
turned out to be wrong :-)

Has anyone ever experienced that behavior in Word2000 and VB 6?
any suggestions for workarounds ("waiting" sucks!)?

For reasons I can't explain here, we can't use COM...

Weasel
February 9th, 2000, 09:44 AM
You could have the VB prog when it recieves the message start into a loop that attepts to open the file (but won't create it if it doesn't exist) . The loop would continue until it was successful, then your prog should work. Just look up the info on opening files.

The ice weasels are coming!