Send outlook email on date

always_confused

Board Regular
Joined
Feb 19, 2021
Messages
68
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I am trying to set up a reminder system for a duty that is to be done everyday by a different person. I have a spreadsheet that looks like this:
NameEmailDay of month
John Ajohn.a@gmail.com01
Sarah Fsarah.f@gmail.com02
.........
Mike Kmike.k@gmail.com31


I would like to make a macro that would email everyone on the list using outlook the same message "Today is your day for ..."

I am honestly not sure where to even start. I think I could figure out looping through the list and checking who's day it is etc, but I have no idea how to set up the actual email part.

Thanks for any help or tips.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
I might skip excel and put this into outlook, with a button on your ribbon to run it.

VBA Code:
Sub remindermail()

Dim myOlApp As Object
Dim MyItem As MailItem
Dim people(31, 2)
people(1, 1) = "John A": people(1, 2) = "john.a@gmail.com"
people(2, 1) = "Mary B": people(2, 2) = "maryb@gmail.com"
people(3, 1) = "Fred C": people(3, 2) = "fredc@gmail.com"
people(4, 1) = "Bill A": people(4, 2) = "billa@gmail.com"
'...
people(28, 1) = "Ted K": people(28, 2) = "tedk@gmail.com"
people(29, 1) = "Silly G": people(29, 2) = "sillyg@gmail.com"
people(30, 1) = "Harry S": people(30, 2) = "harrys@gmail.com"
people(31, 1) = "Mark K": people(31, 2) = "markk@gmail.com"

a = Day(Now())

Set myOlApp = CreateObject("Outlook.Application")
Set MyItem = myOlApp.CreateItem(olMailItem)
MyItem.BodyFormat = olFormatPlain
MyItem.Body = "Today is the day for " & people(a, 1) & ".  Have a nice day."
MyItem.Subject = "Daily Email Reminder"
MyItem.To = people(a, 2)
MyItem.Display ' use .send if you don't need to look at it
End Sub

Instead of hardcoding the list into outlook like this, you can have outlook read a csv file that you maintain in excel.

You can do the same thing from excel really, but then you'd load the file each time. Presumably, Outlook is always running and you can just push a button.
 
Upvote 0
Solution
I might skip excel and put this into outlook, with a button on your ribbon to run it.

VBA Code:
Sub remindermail()

Dim myOlApp As Object
Dim MyItem As MailItem
Dim people(31, 2)
people(1, 1) = "John A": people(1, 2) = "john.a@gmail.com"
people(2, 1) = "Mary B": people(2, 2) = "maryb@gmail.com"
people(3, 1) = "Fred C": people(3, 2) = "fredc@gmail.com"
people(4, 1) = "Bill A": people(4, 2) = "billa@gmail.com"
'...
people(28, 1) = "Ted K": people(28, 2) = "tedk@gmail.com"
people(29, 1) = "Silly G": people(29, 2) = "sillyg@gmail.com"
people(30, 1) = "Harry S": people(30, 2) = "harrys@gmail.com"
people(31, 1) = "Mark K": people(31, 2) = "markk@gmail.com"

a = Day(Now())

Set myOlApp = CreateObject("Outlook.Application")
Set MyItem = myOlApp.CreateItem(olMailItem)
MyItem.BodyFormat = olFormatPlain
MyItem.Body = "Today is the day for " & people(a, 1) & ".  Have a nice day."
MyItem.Subject = "Daily Email Reminder"
MyItem.To = people(a, 2)
MyItem.Display ' use .send if you don't need to look at it
End Sub

Instead of hardcoding the list into outlook like this, you can have outlook read a csv file that you maintain in excel.

You can do the same thing from excel really, but then you'd load the file each time. Presumably, Outlook is always running and you can just push a button.
This is a great solution, thank you very much
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

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