1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| Sub Worksheet_Calculate()
Range("D1").Value = Date
If Range("F2").Value < Range("D1").Value And Range("D3").Value = "OK" Then
Range("F2").ClearContents
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "test@test.com"
.CC = ""
.BCC = ""
.Subject = "Invoice Reminder"
.HTMLBody = Range("B5:G25")
'You can add a file like this
.display 'or use .Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Range("F2").Value = Date
End If
End Sub |