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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Properly closing Outlook

Status
Not open for further replies.

fredmartinmaine

IS-IT--Management
Mar 23, 2015
79
0
0
US
Had a similar issue a while back with Excel and solved it, in similar fashion to the below, but it doesn't appear to be working with Outlook.

My vbscript opens Outlook to parse some things out of an email body. When it comes time to quit the script, I close Outlook like this:

Code:
objEmailItem.Close FALSE  ' close email don't save
Set objEmailItem = Nothing
objOutlook.Application.Quit
Set objOutlook = Nothing
WScript.Quit

While testing, I have task manager open. Rarely, the Outlook object goes grey for a moment, then dies. But - about 95% of the time, it goes grey and hangs there, never dies. I have to kill it with task manager.

Is there a proper way to get Outlook to close cleanly?
Thanks.
 
Odd thing. I was running the script all afternoon, for other development nothing to do with the Outlook bit, and it just started working. Inexplicable and annoyingly inconsistent. I would still be interested to know if the method I am using is correct.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top