G
Guest
I am trying to restrict the Outlook Calendar Items to only the appointments that fall into a specified date range. However, the following code always gives me a "tyoe mismatch or "beginning_date" is not valid"
Could someone show me how to change this to use restrict with a date range
Dim ol As New Outlook.Applicatio
Dim olns As Outlook.Namespac
Dim cf As Outlook.MAPIFolde
Dim c As Outlook.AppointmentIte
Dim objItems As Outlook.Item
Dim objItemsRestricted As Outlook.Item
Dim Prop As Outlook.UserPropert
Dim Beginning_Date As Date, Ending_Date As Dat
Set olns = ol.GetNamespace("MAPI"
Set cf = olns.GetDefaultFolder(olFolderCalendar
Set objItems = cf.Item
Beginning_Date = #2/1/2004
Ending_Date = #3/30/2004 11:59:59 PM
objItems.IncludeRecurrences = Tru
Set objItemsRestricted = objItems.Restrict("[Start] >= Beginning_Date and [End] <= Ending_Date"
Could someone show me how to change this to use restrict with a date range
Dim ol As New Outlook.Applicatio
Dim olns As Outlook.Namespac
Dim cf As Outlook.MAPIFolde
Dim c As Outlook.AppointmentIte
Dim objItems As Outlook.Item
Dim objItemsRestricted As Outlook.Item
Dim Prop As Outlook.UserPropert
Dim Beginning_Date As Date, Ending_Date As Dat
Set olns = ol.GetNamespace("MAPI"
Set cf = olns.GetDefaultFolder(olFolderCalendar
Set objItems = cf.Item
Beginning_Date = #2/1/2004
Ending_Date = #3/30/2004 11:59:59 PM
objItems.IncludeRecurrences = Tru
Set objItemsRestricted = objItems.Restrict("[Start] >= Beginning_Date and [End] <= Ending_Date"