A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

searching for messages where hour(Sent) = 6 AM and hour(Sent) = 9AM(but not by date) ? (Outlook 2003)



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old January 22nd 08, 09:32 PM posted to microsoft.public.office.developer.outlook.vba,microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 4
Default 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

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
can i change the default meeting time from 1/2 hour to 1 hour? Sarah Outlook - Calandaring 2 June 8th 07 02:43 AM
DST: Outlook received mail 1-hour behind [email protected] Outlook - General Queries 4 March 20th 07 09:45 PM
KB928388 DST patch and Outlook 2003 Calendars with one hour offset Mike Dimyan Outlook - Calandaring 12 February 25th 07 01:00 AM
Outlook and 18 hour setting dcs Outlook - Calandaring 1 March 30th 06 04:02 PM
change am-pm to 24 hour time in Outlook [email protected] Outlook - Calandaring 3 February 5th 06 12:40 AM


All times are GMT +1. The time now is 08:53 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.