G
Gabriel RIvera
I have been reading up on how to fire events on vb when
documents open/close and also when the word application
quits... i have also read the document
http://www.mvps.org/word/FAQs/MacrosVBA/PseudoBeforeClose.
htm
which talks about the bug in the DocumentBeforeClose
event. My main problem is that i need to somehow know
when the user closes (hits on the x) the word
application. I have some code checking to see if
documents are open if so, it closes them.
in variable declaration on top..
(dim withevents wapp as new word.application)
in some method.
If wapp.Documents.Count > 0 Then
wapp.Documents.Close
(Word.WdSaveOptions.wdDoNotSaveChanges,
Word.WdOriginalFormat.wdWordDocument, False)
End If
********
the problem is thus the following if the user closes the
word application then the wapp.documents.count>0 will
give me an error( the RPC server is unavailable) since
their is no wapp object in the first place. I need to
know when the user closes the wapp application so i can
start it up again or bypass some lines of code...
Again, the article found here
(http://www.mvps.org/word/FAQs/MacrosVBA/PseudoBeforeClose
..htm
) has a way around this problem but i have used to code
and set breakpoints and i never seem to hit them--> event
now being fired on method...
THanks, a lot.
ps there are a lot of mistakes in msn library (html bugs)
search for example the documentBeforeClose event :~>
gabe
documents open/close and also when the word application
quits... i have also read the document
http://www.mvps.org/word/FAQs/MacrosVBA/PseudoBeforeClose.
htm
which talks about the bug in the DocumentBeforeClose
event. My main problem is that i need to somehow know
when the user closes (hits on the x) the word
application. I have some code checking to see if
documents are open if so, it closes them.
in variable declaration on top..
(dim withevents wapp as new word.application)
in some method.
If wapp.Documents.Count > 0 Then
wapp.Documents.Close
(Word.WdSaveOptions.wdDoNotSaveChanges,
Word.WdOriginalFormat.wdWordDocument, False)
End If
********
the problem is thus the following if the user closes the
word application then the wapp.documents.count>0 will
give me an error( the RPC server is unavailable) since
their is no wapp object in the first place. I need to
know when the user closes the wapp application so i can
start it up again or bypass some lines of code...
Again, the article found here
(http://www.mvps.org/word/FAQs/MacrosVBA/PseudoBeforeClose
..htm
) has a way around this problem but i have used to code
and set breakpoints and i never seem to hit them--> event
now being fired on method...
THanks, a lot.
ps there are a lot of mistakes in msn library (html bugs)
search for example the documentBeforeClose event :~>
gabe