Hello,
I am currently working on a VBA macro which will be picking up email addresses from my excel list and automatically sending out the emails. Unfortunately, it is not including my outlook signature. Can someone please help me understand what is wrong with my VBA below?:
Sub send_mass_email()
Dim i As Integer
Dim email, body, subject, copy As String
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String, SigString As String, Signature As String
body = ActiveSheet.TextBoxes("TextBox 1").Text
i = 2
'Loop down name column starting at row 2 column 2
Do While Cells(i, 2).Value <> ""
email = Cells(i, 2).Value
copy = Cells(i, 3).Value
subject = Cells(i, 4).Value
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.to = email
.cc = copy
.subject = subject
.body = body
.send
End With
'reset body text
body = ActiveSheet.TextBoxes("TextBox 1").Text & Signature
'Change only Mysig.htm to the name of your signature
SigString = Environ("appdata") & "\Microsoft\Signatures\Name.htm"
If Dir(SigString) <> "" Then
Signature = GetBoiler(SigString)
End If
i = i + 1
Loop
Set OutMail = Nothing
Set OutApp = Nothing
MsgBox "Email(s) Sent!"
End Sub
Function GetBoiler(ByVal sFile As String) As String
Dim fso As Object
Dim ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
GetBoiler = ts.readall
ts.Close
End Function
Bookmarks