Make my agenda come to me…
I love the quote from the overly-ambitious Senator Underwood in “House of Cards.” He was talking to Freddy, a blue-collar owner of a restaurant. Freddy was telling him about his ride to work when he had to swerve to avoid a refrigerator that fell out of the back of a truck onto the road. Frank Underwood looked at the camera and said, “See, that’s where Freddy and I are different. I expect the refrigerator to swerve to get out of my way – not the other way around!”
What does this have to do with my calendar? Well it’s a stretch but first thing in the morning I usually go to Outlook and pull up my calendar to see what my agenda looks like. Recently I decided my calendar should come to me instead. So I decided to configure my system to send me an itinerary each morning.
It’s easier than it sounds. Start by simply creating a VBS script file on your local drive. VBS files are instructions to Outlook to email your calendar. Then, using Windows Scheduler, set up a task to run the file each morning.
Here’s How
- Create a text file on your C: Drive and rename it to ’emailCalendar.vbs’. Make sure the extension is “.VBS” and not “.txt.” Then copy and paste the script below into the file. Also make sure you put your actual email address on the 3rd line.
Code |
' ------------------------------------------------- ' Modify this \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Const myEmailAddress = "MyEmailAddress@me.com" Const includePrivateDetails = True Const howManyDaysToDisplay = 1 ' Modify this ///////////////////////////////////// ' ------------------------------------------------- Const olCalendarMailFormatDailySchedule = 0 Const olFreeBusyAndSubject = 1 Const olFullDetails = 2 Const olFolderCalendar = 9 SendCalendar myEmailAddress, Date, (Date + (howManyDaysToDisplay - 1)) Sub SendCalendar(strAdr, datBeg, datEnd) Dim olkApp, olkSes, olkCal, olkExp, olkMsg Set olkApp = CreateObject("Outlook.Application") Set olkSes = OlkApp.GetNameSpace("MAPI") olkSes.Logon olkApp.DefaultProfileName Set olkCal = olkSes.GetDefaultFolder(olFolderCalendar) Set olkExp = olkCal.GetCalendarExporter With olkExp .CalendarDetail = olFreeBusyAndSubject .IncludePrivateDetails = includePrivateDetails .RestrictToWorkingHours = False .StartDate = datBeg .EndDate = datEnd End With Set olkMsg = olkExp.ForwardAsICal(olCalendarMailFormatDailySchedule) With olkMsg .To = strAdr .Send End With Set olkCal = Nothing Set olkExp = Nothing Set olkMsg = Nothing olkSes.Logoff Set olkSes = Nothing Set olkApp = Nothing End Sub |
- From your Windows Start button, type in ‘Task Scheduler’ and enter. Then when the program launches, select Action and “Create a Basic Task” from the menu.
- Give your task a name, click next, then follow the rest of the instructions below. Then when you get to Program Name, find the .VBS file that you just created in Step 1.
That’s it! Each morning you will get a slick-looking email with your agenda for the day or day(s). Also, this will be helpful if you need to share your day with a boss or coworker!
Update (February 2019)
Q: Help, I’m getting a pop-up window in Outlook asking how I want to run this program and the email does not send.
A: The pop up window that you are describing could be a result of an Antivirus software package loaded on your computer. This might be preventing email automations. Also check the Outlook Trust Center options and experiment by adjusting those options. Future security releases of Outlook and or Windows could potentially disable the ability for this program to work as expected.
If you have questions or need some assistance, visit our support page for more help.
Love this. I am not exactly why MS doesn’t have this built in. My searches online look like they did at one point, but did away with it.
My question is if you have more than one email account / calendar is there a way to tell it which calendar to do and which email address to send it to?
Thanks Bart!
To accomplish what you need, please refer to the article below. It’ll require you to have some VBA experience to inject the code snippet as needed. I hope this helps!
https://social.msdn.microsoft.com/Forums/Lync/en-US/be5742bf-d8c3-410c-9a44-5a3fbd653f83/vba-to-select-mailbox-if-an-account-has-multiple-mailboxs?forum=outlookdev