View Single Post
  #3  
Old February 26th 06, 09:44 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default automating body text search

Am Sat, 25 Feb 2006 11:37:19 -0800 schrieb Edward:

Edward, please see the VBA help for a sample of AdvancedSearch.

strF = "urn:schemas:httpmail:body LIKE '' & * & ''"


For searching something that is enclosed in the brackets use:

strF = "urn:schemas:httpmail:textdescription LIKE '%'"

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Actually, I am trying this code:

Private Sub FindSaveAddressInEmails()
On Error Resume Next
Dim objNS As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim objItem As Object
Dim strFind As String
Dim objItems As Outlook.Items

Dim objSch As Search
Dim strF As String
Dim strS As String
Dim strTag As String

Set objNS = Application.GetNamespace("MAPI")
Set objFolder = objNS.PickFolder
If objFolder Is Nothing Then Exit Sub

Set objItems = objFolder.Items

For Each objItem In objItems

strS = "undeliverables"
strF = "urn:schemas:httpmail:body LIKE '' & * & ''"
strTag = "EmailSearch"
objSch = Application.AdvancedSearch(strS, strF, False, strTag)

' objItem.Save
Next

MsgBox "Finished.", vbOKOnly + vbInformation

Set objNS = Nothing
Set objFolder = Nothing
Set objItem = Nothing
Set objItems = Nothing
End Sub

Ads