Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to quickly send email based on date in Excel cell?

Have you ever tried to send an Email based on date in Excel cell? For example, here is a list of dates in column A, and then you want to send an Email with the subject, message body to a recipient (also can CC and BCC to others), how can you handle it?

Send Email based on date with VBA


Send Email based on date with VBA


To send email based on the date in Excel, you only can apply a macro code.

1. Enable the sheet that contains data and date you use, and press Alt + F11 keys to enable the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste below code to the blank script. 

VBA: Send by date

Sub email()
'UpdatebyExtendoffice20170831
    Dim xRg As Range
    Dim xRgEach As Range
    Dim xAddress As String
    Dim xEmail_Subject, xEmail_Send_From, xEmail_Send_To, xEmail_Cc, xEmail_Bcc, xEmail_Body As String
    Dim xMail_Object, xMail_Single As Object
    On Error Resume Next
    xAddress = ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("Select a range:", "KuTools For Excel", xAddress, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    For Each xRgEach In xRg
        If xRgEach.Value = Date Then
            xEmail_Subject = Application.InputBox("Subject: ", "Kutools", , , , , , 2)
            xEmail_Send_From = Application.InputBox("Send from: ", "KuTools For Excel", , , , , , 2)
            xEmail_Send_To = Application.InputBox("Send to: ", "KuTools For Excel", , , , , , 2)
            If xEmail_Send_To = "" Then Exit Sub
            xEmail_Cc = Application.InputBox("CC: ", "KuTools For Excel", , , , , , 2)
            xEmail_Bcc = Application.InputBox("BCC: ", "KuTools For Excel", , , , , , 2)
            xEmail_Body = Application.InputBox("Message Body: ", "KuTools For Excel", , , , , , 2)
            Set xMail_Object = CreateObject("Outlook.Application")
            Set xMail_Single = xMail_Object.CreateItem(0)
            With xMail_Single
                .Subject = xEmail_Subject
                .To = xEmail_Send_To
                .cc = xEmail_Cc
                .BCC = xEmail_Bcc
                .Body = xEmail_Body
                .Send
            End With
        End If
    Next
End Sub

3. Click Run button or press F5 key to execute the code, a dialog pops out to remind you to select a list of date. See screenshot:
doc send by date 1

4. Click OK, and continue to specify the email subject, sender’s email address, receiver’s email address, the CC, BCC, and message body. See screenshot:

doc send by date 2 shot arrow right doc send by date 3 shot arrow right doc send by date 4
        doc arrow down
doc send by date 7 shot arrow left doc send by date 6 shot arrow left doc send by date 5

5. Click OK > OK until last one, and then the email has been sent.
doc send by date 8

Note: the sender’s email address must be the default account in your Outlook.


Create Mailing List and Send Emails

doc send email


Recommended Productivity Tools for Excel

Kutools for Excel Helps You Always Finish Work Ahead of Time, and Stand Out From Crowd

  • More than 300 powerful advanced features, designed for 1500 work scenarios, increasing productivity by 70%, give you more time to take care of family and enjoy life.
  • No longer need memorizing formulas and VBA codes, give your brain a rest from now on.
  • Become an Excel expert in 3 minutes, Complicated and repeated operations can be done in seconds, 
  • Reduce thousands of keyboard & mouse operations every day, say goodbye to occupational diseases now.
  • 110,000 highly effective people and 300+ world-renowned companies' choice.
  • 60-day full features free trial. 60-day money back guarantees. 2 years of free upgrade and support.

Brings Tabbed Browsing and Editing to Microsoft Office, Far More Powerful Than The Browser's Tabs

  • Office Tab is designed for Word, Excel, PowerPoint and Other Office Applications: Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Edward Snyder · 9 months ago
    This is close to what I need but I am stuck with two problems. 1st I need to run this across my entire workbook that gets new worksheets added daily. 2nd I need it to include the worksheet name in the email so I will know which sheet is due. I create new tickets (worksheets) with a field that is a future date, when that day arrives I need an email. Thank you for your help.
  • To post as a guest, your comment is unpublished.
    Stephen Davis · 11 months ago
    How do I get VBA in Excel to generate an email when a cell changes color? I am able to use formula to have cells' font change, based on the computer clock, when a date is within a range before expiry. I currently have a spreadsheet with 25 employee's names and the dates of expiry for their driver's license, work permits, entry/exit visa dates, and annual start date. Some dates are 30 days, some are 60 days. Whenever a date enters the 30 (or 60) day range before expiry, the value in the cell changes from normal black to bold red font. I want to be able to have an email sent to me warning that the person in A1...A2...A3, etc. is about to have a work document expire. What is the script I need to run to accomplish this?