How to open Outlook programmatically.

G

Guest

I want to open the Outlook application just as if I had clicked on the
Outlook icon on the desktop. I do NOT want to assign the Outllok app to a
variable say using CreateObject as this does open an instance of Outlook.exe
but it is not visible and when I leave the procedure and set the variable to
nothing this closes the instance.

I simply want to programmatically open it. I do not want to programmatically
manipulate it in any way. Well not at this point anyway.
 
G

Guest

Hi, Tom.
I want to open the Outlook application just as if I had clicked on the
Outlook icon on the desktop.

Use the Shell method. The following works for Access 2003:

Public Sub openOutlook()

On Error GoTo ErrHandler

Dim retVal As Double

retVal = Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE",
vbNormalFocus)

If (retVal = 0) Then
MsgBox "Failed to open Outlook."
End If

Exit Sub

ErrHandler:

MsgBox "Error in openOutlook( )." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear

End Sub
I do not want to programmatically
manipulate it in any way. Well not at this point anyway.

Later on when you decide to manipulate it, use GetObject( ) instead of
CreateObject( ) to assign the object variable to the current instance of
Outlook.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.

- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 

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