How to modify this code so the profile is automatically selected?

Public Sub OutlookStart()
    On Error Resume Next
    Dim objOL       As Object
    'check if Outlook is running
    Set objOL = GetObject(, "Outlook.Application")
    'on error start Outlook
    If Err.Number <> 0 Then                                          '
        Shell "C:\Program Files\Microsoft Office\Office12\outlook.exe", vbMinimizedFocus
    End If
    Set objOL = Nothing
End Sub

Currently I configured Outlook to prompt for profile. I want to automatically select the profile and bypass the prompt window. How can this be done with VBA?

Who is Participating?
LambertHeenanConnect With a Mentor Commented:
It should work if you use a profile switch in the command line command

Shell "C:\Program Files\Microsoft Office\Office12\outlook.exe" & " /profile profilename", vbMinimizedFocus

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.