In Google Calendar there is an option to receive email on daily events, Google stopped providing free sync b/w Google calendar and Ms Outlook which made me leave the Google calendar, thus I started looking for a way to have similar email for events of Ms Outlook 2010 Calendar.
David Lee on Quora provided the solution. The above can be achieved by using a VBA script. Plz find below the script which should work on Windows computers using Office 2007 and later:
Instructions:
- Open Notepad
- Copy the code below and paste it into Notepad
- On line 10, edit the email address you want the summary sent to
- Save the file. Name it anything you want, the extension must be .vbs
- Using Windows task scheduler, create a new task that runs each morning
- Set the task to run this script
Customization:
- If you want to send email to a 2nd email address as well then uncomment line 11 (remove ‘) and edit the email address
- If you don’t want to receive the confirmation notification then comment line 30 (add ‘)
1: 'VBA Script to Send Daily Summary Email of Outlook Events
2: 'Developed by David Lee techniclee.wordpress.com
3: 'Little Modifications by Nauman Khan naumankhan.blogspot.com
4:
5: Const olCalendarMailFormatDailySchedule = 0
6: Const olFreeBusyAndSubject = 1
7: Const olFullDetails = 2
8: Const olFolderCalendar = 9
9:
10: SendAgenda "someone@company.com", Date, Date
11: 'SendAgenda "someone2@company.com", Date, Date
12:
13: Sub SendAgenda(strAdr, datBeg, datEnd)
14: Dim olkApp, olkSes, olkCal, olkExp, olkMsg
15:
16: Set olkApp = CreateObject("Outlook.Application")
17: Set olkSes = OlkApp.GetNameSpace("MAPI")
18: olkSes.Logon olkApp.DefaultProfileName
19: Set olkCal = olkSes.GetDefaultFolder(olFolderCalendar)
20: Set olkExp = olkCal.GetCalendarExporter
21:
22: With olkExp
23: .CalendarDetail = olFreeBusyAndSubject
24: '.IncludeAttachments = True
25: '.IncludePrivateDetails = True
26: .RestrictToWorkingHours = False
27: .StartDate = datBeg
28: .EndDate = datEnd
29: End With
30: msgbox "Calendar Summary Emailed"
31: Set olkMsg = olkExp.ForwardAsICal(olCalendarMailFormatDailySchedule)
32: With olkMsg
33: .To = strAdr
34: .Send
35: End With
36:
37: Set olkCal = Nothing
38: Set olkExp = Nothing
39: Set olkMsg = Nothing
40: olkSes.Logoff
41: Set olkSes = Nothing
42: Set olkApp = Nothing
43: End Sub
If you are unaware of how to schedule a task in Windows Scheduler then here are the details:
Following are 2 guides on how to schedule a task in windows:
|
|
While giving the path of the VBA script you will have to use a prefix ‘cscript’ to make it work properly. Details can be found in the answer given by Steve Kline on the following link:
|
If there is a possibility that the PC/laptop will be off at the scheduled running time of the script then you can use the following option:
|
Link to my Question on Quora:
|
-urShadow
No comments:
Post a Comment