John Simmons
New Member
- Outlook version
- Outlook 365 64 bit
- Email Account
- Exchange Server
Hello,
I am trying to create a macro to reply to emails with a template. When I use the macro below (which I found online), it puts the sender's name (not email address) in the reply To: box. This is frustrating because then I have to delete the name and copy and paste the actual email address. I tried changing the line with replyEmail.To = origEmail.Sender to replyEmail.To=origEmail.SenderEmailAddress, but then I just got a long string of letters and numbers in the reply To: box when I ran the macro. Any thoughts? Thank you!
Sub MacroName()
Dim origEmail As MailItem
Dim replyEmail As MailItem
Set origEmail = Application.ActiveWindow.Selection.Item(1)
Set replyEmail = Application.CreateItemFromTemplate("C:\path\templatename.oft")
replyEmail.To = origEmail.Sender
replyEmail.CC = origEmail.CC
replyEmail.Subject = origEmail.Subject
replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.Reply.HTMLBody
replyEmail.Display
End Sub
I am trying to create a macro to reply to emails with a template. When I use the macro below (which I found online), it puts the sender's name (not email address) in the reply To: box. This is frustrating because then I have to delete the name and copy and paste the actual email address. I tried changing the line with replyEmail.To = origEmail.Sender to replyEmail.To=origEmail.SenderEmailAddress, but then I just got a long string of letters and numbers in the reply To: box when I ran the macro. Any thoughts? Thank you!
Sub MacroName()
Dim origEmail As MailItem
Dim replyEmail As MailItem
Set origEmail = Application.ActiveWindow.Selection.Item(1)
Set replyEmail = Application.CreateItemFromTemplate("C:\path\templatename.oft")
replyEmail.To = origEmail.Sender
replyEmail.CC = origEmail.CC
replyEmail.Subject = origEmail.Subject
replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.Reply.HTMLBody
replyEmail.Display
End Sub