I just got the course for email remainders but I wold like you to help on how to uautomatically send the email if and especific date is reach or some days before a date.
I just got the course for email remainders but I wold like you to help on how to uautomatically send the email if and especific date is reach or some days before a date.
Hi Rod and welcome,
You could use somrthing like:
Sub SendEmail()
' Email variables.
Dim outlookApp As Object
Dim emailItem As Object
Dim emailSubject As String
Dim emailBody As String
' Get a reference to the Outlook Application Object.
Set outlookApp = CreateObject("Outlook.Application")
' Create the Email Object Item
Set emailItem = outlookApp.CreateItem(0)
' Setup values for the email.
emailSubject = "This is the Subject Line for the email."
emailBody = "This is the message for the email."
' Build and Send the Email
With emailItem
.To = "someone1@somewhere.com; someone2@somewhere.com"
.CC = "anybody1@anywhere.com; anybody2@anywhere.com"
.BCC = "everyone1@everywhere.com; everyone2@everywhere.com"
.Subject = emailSubject
.Body = emailBody
.Attachments.Add ThisWorkbook.FullName
' A1 must be formatted as date - yyyy-mm-dd
' B1 must be formatted as time
.DeferredDeliveryTime = Range("A1").Value & " " & Range("B1").Value
.Display
'.Send
End With
End Sub
Change the To, CC, and BCC lines as needed. The line "DeferredDeliveryTime" can also be hard coded. If you want multiple delayed emails simply have a line for each instance.
Hope this helps.
Cheers :-)