Hi
I am looking for a macro which every day at 18:00 will make a list for the next day
reminders
tasks
appointments
and send an email to my google mail in a .txt file
Is it possible?
I have found the following which is working for calendar but not for reminders and it is not in .txt format
Public Sub SendPrettyAgenda()
Dim oNamespace As NameSpace
Dim oFolder As Folder
Dim oCalendarSharing As CalendarSharing
Dim objMail As MailItem
Dim wd As Integer
Set oNamespace = Application.GetNamespace("MAPI")
Set oFolder = oNamespace.GetDefaultFolder(olFolderCalendar)
Set oCalendarSharing = oFolder.GetCalendarExporter
' get the day - send sat/sun/monday out Fri night
' Sun = 1, Mon = 2, Tue = 3, Wed = 4, Thu = 5, Fri = 6, Sat = 7
' none set Sat/Sun
wd = Weekday(Date)
If wd >= 2 And wd <= 7 Then
lDays = Date + 1
ElseIf wd = 1 Then
lDays = Date + 7
End If
With oCalendarSharing
' options are olFreeBusyAndSubject, olFullDetails, olFreeBusyOnly
.CalendarDetail = olFreeBusyAndSubject
.IncludeWholeCalendar = False
.IncludeAttachments = False
.IncludePrivateDetails = True
.RestrictToWorkingHours = False
.StartDate = Date + 1
.EndDate = lDays
End With
' prepare as email
' options: olCalendarMailFormatEventList, olCalendarMailFormatDailySchedule
Set objMail = oCalendarSharing.ForwardAsICal(olCalendarMailFormatDailySchedule)
' Send the mail item to the specified recipient.
With objMail
.Recipients.Add "me@slipstick.com"
' Remove the attached ics
.Attachments.Remove (1)
.Display 'for testing, change to .send
End With
Set oCalendarSharing = Nothing
Set oFolder = Nothing
Set oNamespace = Nothing
End Sub
I am looking for a macro which every day at 18:00 will make a list for the next day
reminders
tasks
appointments
and send an email to my google mail in a .txt file
Is it possible?
I have found the following which is working for calendar but not for reminders and it is not in .txt format
Public Sub SendPrettyAgenda()
Dim oNamespace As NameSpace
Dim oFolder As Folder
Dim oCalendarSharing As CalendarSharing
Dim objMail As MailItem
Dim wd As Integer
Set oNamespace = Application.GetNamespace("MAPI")
Set oFolder = oNamespace.GetDefaultFolder(olFolderCalendar)
Set oCalendarSharing = oFolder.GetCalendarExporter
' get the day - send sat/sun/monday out Fri night
' Sun = 1, Mon = 2, Tue = 3, Wed = 4, Thu = 5, Fri = 6, Sat = 7
' none set Sat/Sun
wd = Weekday(Date)
If wd >= 2 And wd <= 7 Then
lDays = Date + 1
ElseIf wd = 1 Then
lDays = Date + 7
End If
With oCalendarSharing
' options are olFreeBusyAndSubject, olFullDetails, olFreeBusyOnly
.CalendarDetail = olFreeBusyAndSubject
.IncludeWholeCalendar = False
.IncludeAttachments = False
.IncludePrivateDetails = True
.RestrictToWorkingHours = False
.StartDate = Date + 1
.EndDate = lDays
End With
' prepare as email
' options: olCalendarMailFormatEventList, olCalendarMailFormatDailySchedule
Set objMail = oCalendarSharing.ForwardAsICal(olCalendarMailFormatDailySchedule)
' Send the mail item to the specified recipient.
With objMail
.Recipients.Add "me@slipstick.com"
' Remove the attached ics
.Attachments.Remove (1)
.Display 'for testing, change to .send
End With
Set oCalendarSharing = Nothing
Set oFolder = Nothing
Set oNamespace = Nothing
End Sub