View Single Post
  #4  
Old February 27th 06, 01:29 AM posted to microsoft.public.outlook.program_vba
Edward
external usenet poster
 
Posts: 56
Default automating body text search

The VBA help isn't too clear on how to access the results of the
AdvancedSearch. Do I need a streamwriter to get the info to a text file, or
can I access the object directly somehow?

Much thanks.
--
Phantom Researcher


"Michael Bauer" wrote:

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