I have created a macro that will send a message to the sender when macro is run in outlook.
My problem is how to capture sender's email address. My current code is shown below where I have hard coded the mail id in to field. I want to capture the sender address here. I will appreciate any help..
Public Sub Reply()
Dim otlApp As New Outlook.Application
Dim myMailItem As Outlook.MailItem
Set otlNewMail = otlApp.CreateItem(olMailItem)
With otlNewMail
.To = "xyz@comcast" 'I need to capture sender's mail id here
.CC = "abc@comcast"
.Subject = "Received"
.Body = "Received your application. Thank you for applying for our grant funds. Notice of acceptance for funding applications will be communicated to you in April, 2008. Any questions, please contact our office at 112-223-3334. Keep this e-mail as a record of our office having receipt of your grant application."
End With
otlNewMail.Send
Set otlNewMail = Nothing
Set otlApp = Nothing
End Sub
My problem is how to capture sender's email address. My current code is shown below where I have hard coded the mail id in to field. I want to capture the sender address here. I will appreciate any help..
Public Sub Reply()
Dim otlApp As New Outlook.Application
Dim myMailItem As Outlook.MailItem
Set otlNewMail = otlApp.CreateItem(olMailItem)
With otlNewMail
.To = "xyz@comcast" 'I need to capture sender's mail id here
.CC = "abc@comcast"
.Subject = "Received"
.Body = "Received your application. Thank you for applying for our grant funds. Notice of acceptance for funding applications will be communicated to you in April, 2008. Any questions, please contact our office at 112-223-3334. Keep this e-mail as a record of our office having receipt of your grant application."
End With
otlNewMail.Send
Set otlNewMail = Nothing
Set otlApp = Nothing
End Sub