Outlook Signature not appearing when doing VBA macro

Kemuel Cusing 1 Reputation point
2022-11-13T09:30:25.667+00:00

Can someone help me.. why my outlook signature is not appearing in my VBA code

Sub Mail_Outlook_With_Signature_Html_1()
'Updated by Extendoffice 2018/11/22
Dim xRgDate As Range
Dim xRgSend As Range
Dim xRgSubject As Range
Dim xRgText As Range
Dim xRgDone As Range
Dim xOutApp As Object
Dim xMailItem As Object
Dim xLastRow As Long
Dim vbCrLf As String
Dim xMailBody As String
Dim xRgDateVal As String
Dim xRgSendVal As String
Dim xMailSubject As String
Dim i As Long
On Error Resume Next
Set xRgDate = Application.InputBox("Please select the DELIVERY DATE column:", "Email Follow-up Automation", , , , , , 8)
If xRgDate Is Nothing Then Exit Sub
Set xRgSend = Application.InputBox("Please select the RECIPIENTS column:", "Email Follow-up Automation", , , , , , 8)
If xRgSend Is Nothing Then Exit Sub
Set xRgSubject = Application.InputBox("Please select the SUBJECT column:", "Email Follow-up Automation", , , , , , 8)
If xRgSubject Is Nothing Then Exit Sub
Set xRgText = Application.InputBox("Please select the BODY OF MESSAGE column:", "Email Follow-up Automation", , , , , , 8)
If xRgText Is Nothing Then Exit Sub
xLastRow = xRgDate.Rows.Count
Set xRgDate = xRgDate(1)
Set xRgSubject = xRgSubject(1)
Set xRgSend = xRgSend(1)
Set xRgText = xRgText(1)
Set xOutApp = CreateObject("Outlook.Application")
For i = 1 To xLastRow
xRgDateVal = ""
xRgDateVal = xRgDate.Offset(i - 1).Value
If xRgDateVal <> "" Then
If CDate(xRgDateVal) - Date <= 3 Then
xRgSendVal = xRgSend.Offset(i - 1).Value
xMailSubject = xRgSubject.Offset(i - 1).Value
vbCrLf = "<br><br>"
xMailBody = "<HTML><BODY>"
xMailBody = xMailBody & "Hi, All. " & vbCrLf
xMailBody = xMailBody & "Good Day, " & vbCrLf
xMailBody = xMailBody & xRgText.Offset(i - 1).Value & vbCrLf
xMailBody = xMailBody & "</BODY></HTML>" & "<br><B>Thank you</B>"
Set xMailItem = xOutApp.CreateItem(0)
With xMailItem
.Subject = xMailSubject
.To = xRgSendVal
.CC = "Cusing.Kemuel01@Stuff .com"
.HTMLBody = xMailBody & "<br>" & .HTMLBody
.Display
'.Send
End With
Set xMailItem = Nothing
End If
End If
Next
Set xOutApp = Nothing
End Sub

0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Oskar Shon 866 Reputation points MVP
    2022-11-14T11:29:10.99+00:00

    If you have adding signature on every new mail then in code you should do display and send (not send only).
    or you can add signature in code by function to the .htmlbody text
    For more instructions you can read Ron's article about Signature in mail: signature.htm

    Regards