P
Peter de Vroomen
Hi,
I have an application that starts Word invisible (Office 2000), creates a
document and then sets Word to visible for the user to make some changes. My
application then waits until Word is closed by the user. When the user is
finished (i.e. Word is closed), the document should be automatically copied
to some place and an entry into a database has to be made.
The user has full control over Word when it's visible. One of the things the
user could do is to choose 'Save As...' and save the document at a different
place and under a different name. This would mean that my application would
loose track of the document and cannot copy and register it.
I tried using an event (e.g. the DocumentBeforeClose event) to read the path
and filename from the Word.Document object just before the object quits. But
my application (and Word too) hangs when I try to read the Document.Path or
Document.Name properties. The Word window does not get repainted, so it
looks as if Word's message loop hangs and the property can't be read. This
makes the event unuseable.
The questions are:
1. Am I doing something wrong? Events are dispatched through iDispatch,
aren't they? Then why would Word be deactivated during an event?
2. Is there another/better way to read the path and the filename just before
Word quits or the Word.Document closes?
--
Regards,
Peter de Vroomen
Software Engineer
Jaytown
http://www.jaytown.com
I have an application that starts Word invisible (Office 2000), creates a
document and then sets Word to visible for the user to make some changes. My
application then waits until Word is closed by the user. When the user is
finished (i.e. Word is closed), the document should be automatically copied
to some place and an entry into a database has to be made.
The user has full control over Word when it's visible. One of the things the
user could do is to choose 'Save As...' and save the document at a different
place and under a different name. This would mean that my application would
loose track of the document and cannot copy and register it.
I tried using an event (e.g. the DocumentBeforeClose event) to read the path
and filename from the Word.Document object just before the object quits. But
my application (and Word too) hangs when I try to read the Document.Path or
Document.Name properties. The Word window does not get repainted, so it
looks as if Word's message loop hangs and the property can't be read. This
makes the event unuseable.
The questions are:
1. Am I doing something wrong? Events are dispatched through iDispatch,
aren't they? Then why would Word be deactivated during an event?
2. Is there another/better way to read the path and the filename just before
Word quits or the Word.Document closes?
--
Regards,
Peter de Vroomen
Software Engineer
Jaytown
http://www.jaytown.com