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
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 = NothingEnd Function