PDA

View Full Version : Moving to a folder and executing search parameters



Farrell101
10-30-2008, 10:54 AM
I need to do the following. Move to a folder, search that folder for any message that was recieved today and has the text "Todays meeting".

Assume that I have the folders name stored in a string, I have the text I'm searching for saved as a string, and the date I'm searching for also stored in a string.

How would I go about doing this?

Many Thanks,
Farrell

Demosthine
10-30-2008, 05:23 PM
Good Evening.

Try this:


Public Sub Find_Messages()
Const strSubFolder = "Saved"
Const strSearchString = "Today's Meeting"

Dim folInbox As MAPIFolder
Dim folSaved As MAPIFolder
Dim olmMessage As MailItem
Set folInbox = Session.GetDefaultFolder(olFolderInbox)
Set folSaved = folInbox.Folders.Item(strSubFolder)
Set olmMessage = folSaved.Items.Find(strSearchString)
Do Until olmMessage Is Nothing
' Process Message here.

folSaved.Items.FindNext
Loop
End Sub


Scott