searching for messages where hour(Sent) = 6 AM and hour(Sent) = 9AM(but not by date) ? (Outlook 2003)
I needed to see all messages in my "Sent" folder that were sent
between 6 AM and 9 AM, so I tried
Advanced Search Advanced tab Define more criteria
with
Field: Sent
Condition: between
Value: 6 am and 9 am
but it was not returning anything.
A macro should be able to do it, but I have not had any luck getting
it to work (or finding a decent example that will work in OL 2003).
Can someone post a VBA macro to accomplish the above search or explain
what is wrong with the code below?
Any help would be much appreciated... thanks
'this example searches for any messages in Inbox with a subject of
"Test"
'but returns
'Run-time error '91':
'Object variable or With block variable not set
Sub TestOutlookSearch()
Dim oApp As New Outlook.Application
Dim oSearch As Outlook.Search
Dim iItem As Integer
Dim sResult As String
oSearch = oApp.AdvancedSearch("Inbox",
"urn:schemas:mailheader:subject = 'Test'", True, "") ' search string/
schema examples?
Set oResults = oSearch.Results
For iItem = 1 To oSearch.Results.Count
sResult = sResult & oSearch.Results.Item(iItem).SenderName &
vbCrLf ' what are the other Item properties?
Next
MsgBox (sResult)
End Sub
|