Outlook 2007 Macro Reply to E-mail

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
I found the following code that when I receive a email, I run this and it creates an email back of the template I put in and adds the email message from the other side at the bottom, but does not create the email address back to the email address from I received...so what can we add and where so it adds the email address of the email I received to the To field automatically? I need this as I get emails in certain ways just to respond using a template. Thanks much as usual!!

Sub Reply_Scripting()
Dim origEmail As mailItem
Dim replyEmail As mailItem
Set origEmail = Application.ActiveWindow.Selection.Item(1)
Set replyEmail = Application.CreateItemFromTemplate("C:\Users\Stoler Law\AppData\Roaming\Microsoft\Templates\E-mail From Lou Stoler - Good Morning Follow-Up Marketing to E-Mail Contacts.oft ")
replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.Reply.HTMLBody
replyEmail.Display
End Sub
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
And I found this code that replies to the email address of what was sent to me, but can't figure out how to reply using my template....so either code to be changed so the first one goes the email address of who sent, or this one, we add the template as the reply:

Public Sub ReplyWithHTML()
Dim oMail As outlook.mailItem
Dim oFSO
Dim oFS
If Application.ActiveExplorer.Selection.Count Then
If TypeOf Application.ActiveExplorer.Selection(1) Is outlook.mailItem Then
Set oMail = Application.ActiveExplorer.Selection(1).Reply
oMail.Display
End If
End If
End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Thanks much. I will try it. Please tell me where to put what you posted.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Between the Set replyEmail line where you create the message and the .display line. :)
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Both of them work perfectly!!!! But my automatic signature does not show up any place in the email.....anything to do for that?
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Here is the code...and the signature of me shows up right after the template email....and secondly, after the email message from the other side that is below my reply email.....is there a way in the code, that there is no signature at the bottom of the email after the email message from the other side?

Sub Reply_Good_Morning_Follow_Up_Marketing_Reply_to_Bank_Approved_Contact_Emailtest()
Dim origEmail As mailItem
Dim replyEmail As mailItem
Dim oRespond As outlook.mailItem
Set origEmail = Application.ActiveWindow.Selection.Item(1)
Set replyEmail = Application.CreateItemFromTemplate("C:\Users\Stoler Law\AppData\Roaming\Microsoft\Templates\E-mail From Lou Stoler - Good Morning Follow-Up Marketing Reply to Bank Approved Contact Email.oft ")
replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.Reply.HTMLBody
replyEmail.Subject = "From Lou Stoler - Attorney at Law"

replyEmail.To = origEmail.SenderEmailAddress
replyEmail.Display
End Sub
 

Forum Admin

Senior Member
You want to add the signature? You can save the template with a signature. :)

you can't call a command to insert the signature, you need to add it to the body code using

txtSig = "Lou" & vbcrlf & vbcrlf
replyEmail.HTMLBody = replyEmail.HTMLBody & txtSig & origEmail.Reply.HTMLBody

if you insert HTML, you need to use the raw html code: "<a href=" & chr(34) & "http://myweb" & chr(34) & ">Lou</a>"
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
You don't understand ...look at what I said at my last major post and it says how the two signatures show up...please read that...and let me know please
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
is the signature in the template?

this part is copying the signature if its in the template and it may also be added automatically when you start the new message -
replyEmail.HTMLBody = replyEmail.HTMLBody &
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
I have the normal settings that all emails I send or reply use the signature....but it is not in the template....so I just want the signature at the bottom not to show up as when I reply using my template per the code, it shows my email, my signature and below the email message I received....so just don't want the signature below the email message I received that show up in my reply....hope that makes sense.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
I did the following and it takes off the signature of the bottom and my signature is still at top as a reply, but the email does not show up: so what to add so it runs the template but not another signature automatically:

replyEmail.HTMLBody = origEmail.Reply.HTMLBody
 
Top