The GetOutlook Function : Outlook « Outlook « VBA / Excel / Access / Word






The GetOutlook Function

 
Function GetOutlook() As Outlook.NameSpace
    Dim objOutlook As New Outlook.Application
    Dim objNamespace As Outlook.NameSpace
    Dim strProfile As String
    Dim strPassword As String

    strProfile = "A"
    strPassword = "mypassword"

    Set objNamespace = objOutlook.GetNamespace("MAPI")

    Call objNamespace.Logon(strProfile, _
        strPassword, False, True)

    Set GetOutlook = objNamespace
End Function

 








Related examples in the same category

1.declare the object variable myOutlook and then assign to it a reference to an Outlook.Application object: