Hello,
In the attached workbook and below code, I am trying to accomplish sending an email to a bunch of different contacts with a pdf attachment.
Can this code be changed so an email is sent to multiple recipients with an attachment for each contact? Or does someone know code that will send an email to multiple recipients with a different attachment for each? The pathways for attachments are:
C:\Users\rhoover\Desktop\Caroline.pdf
C:\Users\rhoover\Desktop\Dan.pdf
C:\Users\rhoover\Desktop\Wendy.pdf
C:\Users\rhoover\Desktop\Tina.pdf
C:\Users\rhoover\Desktop\Ryan.pdf
C:\Users\rhoover\Desktop\Pam.pdf
C:\Users\rhoover\Desktop\Trent.pdf
C:\Users\rhoover\Desktop\Dillon.pdf
Sub Email_Rent_Edit()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Dim strbody As String
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
On Error GoTo cleanup
For Each cell In Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And _
LCase(Cells(cell.Row, "C").Value) = "yes" Then
strbody = cell.Offset(0, 3) & vbNewLine
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "Rent Edit"
.Body = "Hi " & Cells(cell.Row, "A").Value & "," & vbNewLine & vbNewLine & strbody
.Attachments.Add "C:\Users\rhoover\Desktop\Caroline.pdf"
.Display 'use Send or Display
End With
On Error GoTo 0
strbody = ""
Set OutMail = Nothing
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
Thank you for any help!!
Bookmarks