I've been use in automation to open MS Word, do some things and exit.
Before I exit I would like the user to be able to do some things.
So I thought I could just check to see if the user closed the document or
exited Word.
No Luck. This code will run with .saved but won't as I show it here.
Can someone give me something that WILL work or at least explain to me what
I'm doing wrong?
Do
Loop Until oWord.ActiveDocument.Close Or Application.Quit
'.Saved
Application.Quit
Exit Sub
Thanx,
Dale
> I've been use in automation to open MS Word, do some things and exit.
>
[quoted text clipped - 17 lines]
>
> Exit Sub
Dim your oWord variable WithEvents:
Dim WithEvents oWord As Word.Application
Then, select oWord in the drop-down listbox at the top left of the
code window, then look in the right-hand drop-down to see all the
events that you can process.
Gale.
JaleDones - 31 Jul 2004 05:31 GMT
Thanx Gale for the assist. I think maybe I've got it.
Your "Dim WithEvents oWord As Word.Application" statement must be placed at
the form level, correct? At least, that's the only way I could get it to
work.
Regards
Dale
> > I've been use in automation to open MS Word, do some things and exit.
> >
[quoted text clipped - 27 lines]
>
> Gale.
Gale Green - 31 Jul 2004 09:45 GMT
> Thanx Gale for the assist. I think maybe I've got it.
>
> Your "Dim WithEvents oWord As Word.Application" statement must be placed at
> the form level, correct? At least, that's the only way I could get it to
> work.
Yes, true. Perhaps I should have mentioned that.
Gale.