Articles → VBA FOR OUTLOOK → Get The Sender Email Address In VBA

Get The Sender Email Address In VBA






Code


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 4, 2019

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250