Sub Mailer()
Dim OutApp As Object, OutMail As Object
Dim rngCell As Range
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
For Each rngCell In Range("B2:B" & Range("B" & Rows.Count).End(xlUp).Row)
If DateSerial(Year(Date), Month(rngCell.Value), Day(rngCell.Value)) = Date Then
With OutMail
.To = rngCell.Offset(0, 1).Value
.CC = ""
.BCC = ""
.Subject = "Happy Birthday"
.Body = "Blah Blah Blah"
.Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
With Application
waitTime = TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1)
.Wait waitTime
.SendKeys "%s~~~"
End With
End If
Next rngCell
End Sub
Public dTime As Date
Sub Mailer()
Dim OutApp As Object, OutMail As Object
Dim rngCell As Range
dTime = Now + 1
Application.OnTime dTime, "Mailer"
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
For Each rngCell In Range("B2:B" & Range("B" & Rows.Count).End(xlUp).Row)
If DateSerial(Year(Date), Month(rngCell.Value), Day(rngCell.Value)) = Date Then
With OutMail
.To = rngCell.Offset(0, 1).Value
.CC = ""
.BCC = ""
.Subject = "Happy Birthday"
.Body = "Blah Blah Blah"
.Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
With Application
waitTime = TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1)
.Wait waitTime
.SendKeys "%s~~~"
End With
End If
Next rngCell
End Sub
Private Sub Workbook_Open()
Application.OnTime TimeValue("20:30:00"), "Mailer"
End Sub