Retrieving Calendar Info

  • Thread starter Thread starter CharlieH
  • Start date Start date
C

CharlieH

Can anyone tell me why this code (VBA Excel2003) is NOT returning recurring
meetings? Thanks.

Sub Get_Meeting_Details()
Dim myOlApp As Outlook.Application
Dim myNamespace As Outlook.Namespace
Dim myMeetings As Outlook.Items
Dim myItems As Outlook.Items
Dim myItem As Object
Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myMeetings = myNamespace.GetDefaultFolder(olFolderCalendar).Items

mytimestart = Format(Range("A1"), "mm/dd/yyyy")
Range("A3").Select
strFilter = "[Start] > " & Quote(mytimestart & " 00:00") & " And [Start]
< " & Quote(mytimestart & " 23:59")
Set myItems = myMeetings.Restrict(strFilter)

myItems.Sort "[Start]"
For Each myItem In myItems
vblHours = vblHours + myItem.Duration
ActiveCell.Value = myItem.Start
ActiveCell.Offset(0, 3).Value = myItem.Subject
ActiveCell.Offset(0, 4).Value = myItem.Location
ActiveCell.Offset(0, 8).Value = myItem.Duration / 60
ActiveCell.Offset(1, 0).Select
Next
End Sub
 
Thanks!! That did it.

Dmitry Streblechenko said:
You never set the myItems .IncludeRecurrences property to true.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
CharlieH said:
Can anyone tell me why this code (VBA Excel2003) is NOT returning
recurring
meetings? Thanks.

Sub Get_Meeting_Details()
Dim myOlApp As Outlook.Application
Dim myNamespace As Outlook.Namespace
Dim myMeetings As Outlook.Items
Dim myItems As Outlook.Items
Dim myItem As Object
Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myMeetings = myNamespace.GetDefaultFolder(olFolderCalendar).Items

mytimestart = Format(Range("A1"), "mm/dd/yyyy")
Range("A3").Select
strFilter = "[Start] > " & Quote(mytimestart & " 00:00") & " And
[Start]
< " & Quote(mytimestart & " 23:59")
Set myItems = myMeetings.Restrict(strFilter)

myItems.Sort "[Start]"
For Each myItem In myItems
vblHours = vblHours + myItem.Duration
ActiveCell.Value = myItem.Start
ActiveCell.Offset(0, 3).Value = myItem.Subject
ActiveCell.Offset(0, 4).Value = myItem.Location
ActiveCell.Offset(0, 8).Value = myItem.Duration / 60
ActiveCell.Offset(1, 0).Select
Next
End Sub
 
Back
Top