Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook object--closing it?

Status
Not open for further replies.

jsteph

Technical User
Oct 24, 2002
2,562
US
Hi all,
In Access 2003, I have code that sends email using the Outlook.Application object. At the end of the code, after sending the email and making sure the outbox is empty, I use the .quit method and set the object references to Nothing. Yet in the taskmanager, Outlook is still there. And I know it was not there when the code starts--I test this and see Outlook pop into taskmgr when I run the code, then the .quit method throws no errors, but Outlook remains.

The problem is--and this I cannot re-create at-will--that sometimes it creates a second, sometimes third listing for Outlook in the taskmgr. I'm using the New Outlook.application to set the object--but I can step through it a dozen times and it will keep the same single Outlook listing in the taskmgr, but other times when I let the process run automatically, I'll come back and see 3 Outlooks listed (all under same username).

So is this normal, is there another way to quit outlook in code? Or is it an MS thing where it decides to cache the object instance in case it has some background cleanup to do?
Thanks,
--Jim
 
Without seeing your code it's hard to say you if you're responsible of the ghost instance(s) of Outlook ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
jsteph . . .

Are you [blue]quiting first[/blue] and then setting the objects to nothing?

Calvin.gif
See Ya! . . . . . .
 
Yes, quitting first and then setting to nothing. And I know that I'm responsible for the instance of Outlook because I watch it pop in the task window when i do the New in the code. Yet when I .Quit and set to Nothing, Outlook remains in the taskbar.

Then sometimes--again not consistently reproduceable--when I do the next run of this code, another outlook instnace pops in--but other times the New just seems to piggyback on the existing instance.
--Jim
 
jsteph . . .

Then you need to [blue]post the code![/blue] . . .

Calvin.gif
See Ya! . . . . . .
 
What version of outlook are you using?

And have you tried starting outlook using CreateObject rather than New Outlook.Application?

Hope this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
I've been caught up in another project...I'll post the code when I get back to the office,
--Jim
 
All,
I've given up on this for now and am using a 3rd party email tool, due to another issue--the infamous security prompt "A program is trying to automatically send email on your behalf".

I've looked in threads here and elswhere on that and there's no elegant workaround so I'm dropping Outlook as the mail tool for this app, which makes my original post in this thread moot, but I appreciate all your help,
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top