Good day professionals
I'm using the following VBA code to automatically send mass emails through MS outlook, however my signature is not showing, seeking your support to add the VBA portion to the below code so I can send mass emails with signature and logos:
I'm using the following VBA code to automatically send mass emails through MS outlook, however my signature is not showing, seeking your support to add the VBA portion to the below code so I can send mass emails with signature and logos:
Code:
Sub send_email()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Sheet1")
Dim OA As Object
Dim msg As Object
Set OA = CreateObject("Outlook.Application")
Dim each_row As Integer
Dim last_row As Integer
last_row = Application.WorksheetFunction.CountA(sh.Range("B:B"))
For each_row = 2 To last_row
Set msg = OA.createitem(0)
msg.To = sh.Range("B" & each_row).Value
first_name = sh.Range("C" & each_row).Value
last_name = sh.Range("D" & each_row).Value
msg.cc = sh.Range("E" & each_row).Value
msg.Subject = sh.Range("F" & each_row).Value
msg.body = sh.Range("G" & each_row).Value
date_to_send = sh.Range("I" & each_row).Value
date_to_send = Format(date_to_send, "dd/mm/yyyy")
Status = sh.Range("J" & each_row).Value
current_date = Format(Date, "dd/mm/yyyy")
If date_to_send = current_date Then
If sh.Range("H" & each_row).Value <> "" Then
msg.attachments.Add sh.Range("H" & each_row).Value
Cells(each_row, 9).Value = "Sent"
Content = Replace(msg.body, "<>", first_name + " " + last_name)
msg.body = Content
msg.send
Else
Cells(each_row, 9).Value = "Sent"
Content = Replace(msg.body, "<>", first_name + " " + last_name)
msg.body = Content
msg.send
End If
End If
Next each_row
End Sub
Last edited by a moderator: