Articles → VBA FOR OUTLOOK → Get the sender email address in VBA

Get the sender email address in VBA


 Dim SenderEmail As String
    Set objOutlook = CreateObject("Outlook.Application")
    Set outMailItem = objOutlook.CreateItem(olMailItem)
    If oOutlook.SenderEmailType = "EX" Then
       If oOutlook.Sender <> "" Then
           SenderEmail = oOutlook.Sender.GetExchangeUser.PrimarySmtpAddress
       ElseIf outMailItem.SenderEmailType = "SMTP" Then
           SenderEmail = oOutlook.SenderEmailAddress
       End If
    End If

    MsgBox SenderEmail

Posted By  -  Karan Gupta
Posted On  -  Thursday, April 04, 2019


Your Email Id  
Query/FeedbackCharacters remaining 250