PDA

View Full Version : Add Signature to Reply Email?



VBE313
12-26-2019, 06:50 AM
I want to use my default signature in a reply email. I am using Signature as an example.

Sub ReplyMSG12()
Dim nameExample As String
Dim olItem As Outlook.MailItem
Dim olInsp As Outlook.Inspector
Dim wdDoc As Object
Dim oRng As Object
Dim olReply As MailItem
Dim Signature As String
Signature = Environ("AppData") & "\Microsoft\Signatures" & "MainSig.htm"
For Each olItem In Application.ActiveExplorer.Selection
nameExample = Split(olItem.SenderName, Chr(32))(0)
Set olReply = olItem.ReplyAll
olReply.Display
With olReply
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
Set oRng = wdDoc.Range(0, 0)
oRng.Text = "Hi " & nameExample & vbCr & vbCr & _
"We are in receipt of your RFQ" & vbCr & vbCr & _
"Thanks," & vbCr & vbCr & _
Signature
End With
DoEvents
Next olItem
Set olReply = Nothing
Set olItem = Nothing
Set olInsp = Nothing
Set wdDoc = Nothing
Set oRng = Nothing
End Sub

gmayor
12-26-2019, 07:37 AM
If you have a signature associated with that account, the code should leave that signature.
If it doesn't, change the line

Set oRng = wdDoc.Range(0, 0)
to

Set oRng = wdDoc.Range
oRng.Collapse 1

VBE313
12-26-2019, 07:58 AM
Hi Graham,

Thank you for this! I just had to go to my Signature settings and have it displayed on reply emails.