Is Microsoft Outlook running? + How do I start It

Pingolin
Pingolin used Ask the Experts™
on
Can someone tell me how I can see if Microsoft Outlook is running or not.

How do I start Microsoft Outlook within my VB-program?

Please provide me with some code.

Thanx.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You can use the GetObject function to try to get a reference to the Outlook "Applciation" object. If an error occurs (trap it), it's not running.

To start it, you can either call the outlook .exe with the Shell function if you want it to be visible to the user or use CreateObect to keep it to yourself.
"Automating Outlook from other Microsoft Office applications"
This explains the basics of what I suggested
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000/html/olconAutomatingOutlookFromOtherMicrosoftOfficeApplications.asp

From Microsoft Office XP Developer documentation:
"Office Application Automation"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/modcore/html/deconAutomatingOtherOfficeApplications.asp

Using the CreateObject and GetObject Functions (also from Microsoft Office XP Developer documentation)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/modcore/html/deconusingcreateobjectgetobjectfunctions.asp

CreateObject example on MSDN
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000/html/olmthCreateObjectX.asp

Commented:
Ping,

You can use the MAPI controls and if outlook is open it will use the open connection.  If it isn't open it will prompt the user to open it.  Here is a quick example using the component reference to Microsoft Mapi Controls 6.0

MAPIMessage.SessionID = MAPISession.SessionID
MAPIMessage.MsgIndex = -1
MAPIMessage.Compose

This will open Outlook to create a new message.  Then you can do whatever you want with the MapiMessage Control.

G

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial