P
Peter Marchert
Hello,
I have a restrict problem on german computers only.
The following code works fine on an english system:
Sub Test1()
Dim objCalendar As Outlook.MAPIFolder
Dim objAppis As Outlook.Items
Dim strFilter As String
Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)
strFilter = "[Start] = '" & Format("8/25/07", "ddddd h:nn AMPM") &
"'"
Set objAppis = objCalendar.Items.Restrict(strFilter)
Debug.Print objAppis.Count
End Sub
All items with the specified start date are returned. The same code on
a german system returns no items ("objAppis.Count" is always zero).
This code:
Sub Test2()
Dim objCalendar As Outlook.MAPIFolder
Dim objAppis As Outlook.Items
Dim strFilter As String
Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)
strFilter = "[Start] > '" & Format("8/24/07", "ddddd h:nn AMPM") &
"'" & _
"AND [Start] < '" & Format("8/26/07", "ddddd h:nn AMPM") & "'"
Set objAppis = objCalendar.Items.Restrict(strFilter)
Debug.Print objAppis.Count
End Sub
returns all items between 8/25/07 and 8/26/07. So I`m afraid this is a
bug in Outlook or only a date formatting problem.
Thanks in advanced for any help!
Peter
I have a restrict problem on german computers only.
The following code works fine on an english system:
Sub Test1()
Dim objCalendar As Outlook.MAPIFolder
Dim objAppis As Outlook.Items
Dim strFilter As String
Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)
strFilter = "[Start] = '" & Format("8/25/07", "ddddd h:nn AMPM") &
"'"
Set objAppis = objCalendar.Items.Restrict(strFilter)
Debug.Print objAppis.Count
End Sub
All items with the specified start date are returned. The same code on
a german system returns no items ("objAppis.Count" is always zero).
This code:
Sub Test2()
Dim objCalendar As Outlook.MAPIFolder
Dim objAppis As Outlook.Items
Dim strFilter As String
Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)
strFilter = "[Start] > '" & Format("8/24/07", "ddddd h:nn AMPM") &
"'" & _
"AND [Start] < '" & Format("8/26/07", "ddddd h:nn AMPM") & "'"
Set objAppis = objCalendar.Items.Restrict(strFilter)
Debug.Print objAppis.Count
End Sub
returns all items between 8/25/07 and 8/26/07. So I`m afraid this is a
bug in Outlook or only a date formatting problem.
Thanks in advanced for any help!
Peter