You should be able to use this code for your workbook. Assuming that you have the emails and everything in the same place otherwise it needs to be modified. Also I did not know how you wanted the email phrased so you may want to look it over
Sub email()
Dim rngCell As Range
Dim rngMyDataSet As Range
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Dim EmailSubject As String
Dim EmailSendTo As String
Dim MailBody As String
Dim EmailRecipient As String
Dim Signature As String
Dim SigString As String
Dim strbody As String
Application.ScreenUpdating = False
With ActiveSheet
If .FilterMode Then .ShowAllData
For Each rng In Range("N1:N4")
If Cells(rng.Row, "O").Value > 0 Then
ElseIf Cells(rng.Row, "B").Value >= Evaluate("Today() ") And _
Cells(rng.Row, "B").Value <= Evaluate("Today() +30") Then
Cells(rng.Row, "O").Value = Date
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "Dear " & Cells(rng.Row, "E").Value & vbNewLine & vbNewLine & "According to our records your quote number " & Cells(rng.Row, "A").Value & " expired on " & Cells(rng.Row, "B").Value & vbNewLine & _
"Could you please contact us about this."
Signature = "C:\Documents and Settings\" & Environ("rmm") & _
"\Application Data\Microsoft\Signatures\rm.htm"
EmailSendTo = Cells(rng.Row, "B").Value
EmailSubject = "the subject"
EmailRecipient = Cells(rng.Row, "E").Value
On Error Resume Next
With OutMail
.to = EmailSendTo
.CC = ""
.BCC = ""
.Subject = EmailSubject
.Body = strbody
.display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End If
Next rng
Application.ScreenUpdating = True
End With
End Sub
Bookmarks