Avatar of Fordraiders
Fordraiders
Flag for United States of America asked on

check outlook from access vba with a specific profile name

Check Outlook for several options:




If not open: Open with specific profile:
Dim objOL As Outlook.Application
    On Error Resume Next
    Set objOL = GetObject(, "Outlook.Application")
    If objOL Is Nothing Then
        Set objOL = CreateObject("Outlook.Application")
        objOL.Session.Logon ProfileName, , False, True
    End If
    Set OpenOL = objOL
    Set objOL = Nothing

Open in new window







If outlook is open :
Look for the profile name: if it is not a specific profile name then close it and open with a specific prpfile name...

Need code for checking outlook with a specific profile name ??


Function OpenOL(Optional ProfileName) As Outlook.Application
    Dim objOL As Outlook.Application
    On Error Resume Next
    Set objOL = GetObject(, "Outlook.Application")
    If objOL Is Nothing Then
        Set objOL = CreateObject("Outlook.Application")
        objOL.Session.Logon ProfileName, , False, True
    End If
    Set OpenOL = objOL
    Set objOL = Nothing
End Function

Open in new window




Thanks
Fordraiders
Microsoft AccessOutlookVBA

Avatar of undefined
Last Comment
Fordraiders

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rgonzo1971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Fordraiders

ASKER
thanks  !
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy