Reputation: 77
When you click reply all in outlook, it will open a new email box, but show the previous email thread underneath the body of your email. I am trying to Reply All to the selected email in outlook and input information. I want to do this all from a Macro in Excel. My problem is that if I try to write in the body of the Reply All, it erases the entire previous email thread.
Sub test()
Dim mail 'object/mail item iterator
Dim replyall 'object which will represent the reply email
For Each mail In Outlook.Application.ActiveExplorer.Selection
If mail.Class = olMail Then
Set replyall = mail.replyall
With replyall
'.Body = "blah blah hello world" '<-- uncomment and it will delete the thread
.Display
End With
End If
Next
End Sub
Note: the closest I've come is this, but it deletes my signature, the email separator, and the header info from the latest email:
.Body = "blah blah hello world" & mail.body
Any solutions are appreciated! Thanks!
Upvotes: 3
Views: 9578
Reputation: 66215
For the plain text, you can do
.Body = "blah blah hello world" & vbCrLf & .Body
If you want to preserve formatting, you will need to insert your string into the replyall.HTMLBody
property (you cannot just concatenate two HTML strings).
Upvotes: 6