VB Script to shutdown Outlook?

S

S. Craft

Can someone tell me how to write a VB script to force Outlook to shut down?
I already have this:

set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.AppActivate "Inbox - Microsoft Outlook"
WScript.Sleep 500
WshShell.SendKeys("%{F4}")
set WshShell = Nothing

But that will only shut down Outlook if the Inbox is selected. Is there
some other, similar command or syntax I can use to shut down the application
regardless of what folder is selected? Pardon my VB ignorance.

Alternately, if anyone has any other suggestions to force Outlook to shut
down, I would love to hear them. I've already tried using MS's KILL.EXE,
with which I have had only moderate success, and it nearly always generates
a Windows error, which screws up my batch file. I was hoping to find a
command line parameter -- like "outlook.exe /shutdown" or something -- but a
/shutdown switch appears not to exist.

Any help at all would be greatly appreciated.

-SC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top