How to (Use Outlook to search for text in message)

S

sturger

I would like to know how to create a macro that will read all messages in
current and sub folders looking for the following information,

Messages where "Leave Alone" is found and out put is
Virus Found "Inserts Virus iNFO" | Computer "Computer Name"

Example Alert message
Alert: Virus Found TEST
Leave Alone
Computer: PC1234
Date: 11/24/2007
Time: 7:09:59 PM
Severity: Critical


Thanks,
 
M

Michael Bauer [MVP - Outlook]

Here's a sample for how to loop recursively through the folders:
http://www.vboffice.net/sample.html?mnu=2&id=6&smp=12&cmd=showitem&lang=en

For the current folder first call:

LoopItems Application.activeExplorer.CurrentFolder

And then:

LoopFolders Application.ActiveExplorer.CurrentFolder.Folders

In HandleItem you might look for any text either in the item's Subject or
Body property. Use the Instr function for that.

--
Best regards
Michael Bauer - MVP Outlook
Synchronize Color Categories & Ensure that Every Item Gets Categorized:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>


Am Sun, 25 Nov 2007 05:41:00 -0800 schrieb sturger:
 
S

Sue Mosher [MVP-Outlook]

Another approach would be to use the Application.AdvancedSearch method, which can both search subfolders and do substring searches.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
Top