I am looking for outlook macro which will enable me to reply to all with specific text. I need later to link this macro to icon in the quick access toolbar.
Printable View
I am looking for outlook macro which will enable me to reply to all with specific text. I need later to link this macro to icon in the quick access toolbar.
The following should work
Code:Sub ReplyToAllWithText()
'Graham Mayor - https://www.gmayor.com - Last updated - 19 Nov 2018
Dim olMsg As MailItem
Dim olReply As MailItem
Dim olInsp As Inspector
Dim wdDoc As Object
Dim oRng As Object
Dim strTo As String
On Error GoTo Err_Handler
Set olMsg = ActiveExplorer.Selection.Item(1)
Set olReply = olMsg.ReplyAll
With olReply
.BodyFormat = olFormatHTML
.Display
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
Set oRng = wdDoc.Range
oRng.collapse 1
oRng.Text = "This is a line of text." & vbCr & _
"This is another line" & vbCr & _
"This line will be followed by your account signature."
End With
lbl_Exit:
Set olMsg = Nothing
Set olReply = Nothing
Set wdDoc = Nothing
Set oRng = Nothing
Exit Sub
Err_Handler:
Beep
Err.Clear
GoTo lbl_Exit
End Sub
If you are happy it works as you require, add the lineimmediately before the lineCode:.send
Do not remove theCode:End With
line or the message body will not be written.Code:.Display