Searching for Items : Email « Outlook « VBA / Excel / Access / Word






Searching for Items

 
Sub Sample_Advanced_Search()
    Dim mySearch As Search
    Dim myResults As Results
    Dim intCounter As Integer
    Set mySearch = AdvancedSearch(Scope:="Inbox",Filter:="urn:schemas:mailheader:subject = 'Project'")
    Set myResults = mySearch.Results
    If myResults.Count > 0 Then
        Debug.Print "found"
    For intCounter = 1 To myResults.Count
        Debug.Print myResults.Item(intCounter).SenderName
    Next intCounter
    Else
        Debug.Print "no messages that match the search criteria."
    End If
End Sub

 








Related examples in the same category

1.Send email for all records in an Access table
2.Send email by Using POP3
3.Display the information in a list of mails
4.Adds an addressee, a subject, and body text; applies the HTML format; sets the importance to high; and sends the message:
5.Sending a Message
6.Send a table through email
7.Using the CreateItem Method to Create Default Items
8.Send out an email by using the DoCmd.SendObject