Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / July 2004



Tip: Looking for answers? Try searching our database.

Newbie Question-- What's the matter with this?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JaleDones - 29 Jul 2004 01:30 GMT
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
Gale Green - 30 Jul 2004 11:33 GMT
> 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.
 
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



©2009 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.