VBcode to send email to email_list automatically if today's date = date in range

GWiseman

New Member
Joined
May 28, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Want to setup on automatic daily schedule. Ok, to have VBA script in Power Automate Desktop flow but if not necessary that is fine too. Below is the code I am starting with from another post and my example table. Any help would be great! Thanks

Full NameFirst NameLast NameStatusTypeQuote Date3rd Day6th Day30th Day140th DayEmail
Matt GrandburyMattGrandburyNoHome
5/29/2021​
6/1/2021​
6/4/2021​
6/28/2021​
10/16/2021​
somebody@gmail.com
Patrick BisketPatrickBisketNoAuto
5/30/2021​
6/2/2021​
6/5/2021​
6/29/2021​
10/17/2021​
somebody@yahoo.com
Gilda WintersGildaWintersNoAuto
5/30/2021​
6/2/2021​
6/5/2021​
6/29/2021​
10/17/2021​
somebody@aol.com
Gilda WintersGildaWintersYesTen
5/30/2021​
6/2/2021​
6/5/2021​
6/29/2021​
10/17/2021​
somebody@hotmail.com


Sub send_mail()
Dim xdate As Date
xdate = Worksheets("Quoted Prospects").Range(Range("G2").End(xlDown), Range("J2").End(xlDown))
Dim OutApp As Object
Dim outmail As Object
Dim mail_list As Range
Dim cell As Range

Application.ScreenUpdating = False
On Error GoTo error_exit

Set mail_list = Range(Range("K2"), Range("K2").End(xlDown))

For Each cell In mail_list
Set outmail = OutApp.createitem(0)
On Error Resume Next
With outmail
.to = cell.Value
.Subject = "Quote Followup"
.body = "Hi " & Cells(cell.Row, "B").Value & "," & vbNewLine & vbNewLine & _
"Now that you have had time to review the Quote, let's get you going with your new policy/s. What would be the best time to call to discuss?" & vbNewLine & vbNewLine & _
"Regards," & vbNewLine & _
"Patrick"
.send
End With
On Error GoTo 0
Set outmail = Nothing

Next cell
error exit:
End Sub
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,223,228
Messages
6,170,874
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top