Use Instant search to find messages from a contact

Last reviewed on January 7, 2013

Applies to Microsoft Outlook 2013, Outlook 2010, Outlook 2007

Older versions of Outlook have the Activities tab which will find all Outlook items associated with a particular contact. Activities are broken in Outlook 2010 and removed from Outlook 2013.

While you can use the Social Connector's People pane to see all messages, appointments, and attachments from a person, you can also use Instant Search. Type from:(name) or from:(email@address) in the Instant search field.

Instant Search field

This macro makes it easier to use Instant Search to find messages for a selected contact, by entering the contact's name or email address into the Instant Search field in the Inbox.

If you need persistent search results, see How to create an Outlook search folder using VBA.

This macro can use any valid Instant search criteria. You just need to replace or edit the txtSearch line. To find messages to and from a contact, use txtSearch = "from:" & strFilter & " OR to:" & strFilter

Search for messages from contact macro

  1. Open the VBA editor using Alt+F11
  2. Right click on Project1 and choose Insert > Module
  3. Paste the following code into the module.
  4. Set macro security to low to test the code, then use Selfcert to sign the macro before change security to high.
  5. Add the macro to a ribbon, QAT, or toolbar button.
  6. Select a contact and run the macro.

Sub SearchByAddress()

Dim myOlApp As New Outlook.Application
Dim ns As Outlook.NameSpace
Dim strFilter As String
Dim oContact  As Outlook.ContactItem

Set ns = myOlApp.GetNamespace("MAPI")

Set oContact = ActiveExplorer.Selection.item(1)

' use oContact.FullName to search on the name
strFilter = oContact.Email1Address
 
Set myOlApp.ActiveExplorer.CurrentFolder = ns.GetDefaultFolder(olFolderInbox)

txtSearch = "from:" & strFilter
myOlApp.ActiveExplorer.Search txtSearch, olSearchScopeAllFolders

Set myOlApp = Nothing

End Sub

Search Journal

If you are still using Journal, you can tweak the macro to search the journal for items associated with the contact. Change the contact field to Full name and the folder to journal.

strFilter = oContact.FullName
Set myOlApp.ActiveExplorer.CurrentFolder = ns.GetDefaultFolder(olFolderJournal)


' change the search filter to look for the contact name
txtSearch = "contactnames:(" & strFilter & ")"

Valid Search Scopes

Outlook 2010 and Outlook 2013 use the following search scopes:

ScopeDescription
olSearchScopeCurrentFolderLimit the search to the currently selected folder.
olSearchScopeSubfoldersLimit the search to the currently selected folder and its subfolders. To search all folders in one data file, select the top level of the pst.
olSearchScopeAllFoldersSearch all folders (of the current folder type). This search includes all data stores that are enabled for search.
olSearchScopeAllOutlookItemsSearch all Outlook items in all folders in stores that are enabled for search.

Outlook 2007 users are are limited to olSearchScopeAllFolders and olSearchScopeCurrentFolder.

Written by

Diane Poremsky
A Microsoft Outlook Most Valuable Professional (MVP) since 1999 and involved in IT support since 1985, Diane is the author of several books and video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.