Hi, I currently have a spreadsheet listing candidates names and information, including a column of dates (column B), of when these people started placements. I am looking to have excel send an email to one specific address, 30 days after the date...
Hi, I currently have a spreadsheet listing candidates names and information, including a column of dates (column B), of when these people started placements. I am looking to have excel send an email to one specific address, 30 days after the date listed to let us know that the manager needs to be contacted. The code I have so far is:
Sub Mail_small_Text_Outlook()
If Cells(b, 1).Value = (Date + 30) Then
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
strbody = "Hi there" & vbNewLine & vbNewLine & _
"Placements in red are coming to three month limit"
On Error Resume Next
With OutMail
.To = "email address"
.CC = ""
.BCC = ""
.Subject = "Overdue placement"
.Body = strbody
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End If
End Sub
I originally was able to get the macro to run to send the email every time excel opened but cant seem to tweek it to only get it send when a date is out of the 30 days. At the moment I have also only used B1 as an example, but would like it obviously to run for all of the dates listed in column B.
My only work with macro code is self taught with help from forums such as this so any help is greatly appreciated
Thanks