R
Robert
Environment:
Outlook 2002 SP3
XP Professional
Solution Attempt:
Trying to use VBA return the same data I have in 3 saved
advanced searches.
Problem:
I have an advanced search, (ctrl+shift+f), returns tasks
from my task folder with the following criteria defined
in the advanced tab.
Field Condition Value
-----------------------------------
Complete equals Yes
Date Completed last week
I have tried to create this advanced search query in the
following VBA code.
Set ol = New Outlook.Application
Set NS = ol.GetNamespace("MAPI")
Set oTasks = NS.GetDefaultFolder(olFolderTasks).Items
sTaskCompleteFilter = "[Complete] = True and [Date
Completed] = 'last week'"
oTasks.Sort "[Date Completed]", False
Set oResItems = oTasks.Restrict(sTaskCompleteFilter)
For Each oItm In oResItems
Debug.Print oItm.Subject
Next
Results:
When I run the VBA code it seems it only reports back
tasks that have been completed exactly 7 days prior. For
example, if I run the report today, Aug 13, 2004. It
only reports task completed on date Aug 6, 2004 not those
from Aug 1 through Aug 7. That would be Sunday to
Saturday which is last week because my week starts on
Sunday. The advanced search works just find.
Thanks in advanced for your help.
Outlook 2002 SP3
XP Professional
Solution Attempt:
Trying to use VBA return the same data I have in 3 saved
advanced searches.
Problem:
I have an advanced search, (ctrl+shift+f), returns tasks
from my task folder with the following criteria defined
in the advanced tab.
Field Condition Value
-----------------------------------
Complete equals Yes
Date Completed last week
I have tried to create this advanced search query in the
following VBA code.
Set ol = New Outlook.Application
Set NS = ol.GetNamespace("MAPI")
Set oTasks = NS.GetDefaultFolder(olFolderTasks).Items
sTaskCompleteFilter = "[Complete] = True and [Date
Completed] = 'last week'"
oTasks.Sort "[Date Completed]", False
Set oResItems = oTasks.Restrict(sTaskCompleteFilter)
For Each oItm In oResItems
Debug.Print oItm.Subject
Next
Results:
When I run the VBA code it seems it only reports back
tasks that have been completed exactly 7 days prior. For
example, if I run the report today, Aug 13, 2004. It
only reports task completed on date Aug 6, 2004 not those
from Aug 1 through Aug 7. That would be Sunday to
Saturday which is last week because my week starts on
Sunday. The advanced search works just find.
Thanks in advanced for your help.