Retrieving Calendar Info

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
 
C

CharlieH

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top