First, you will need to determine the display name of the Outlook store which contains your search folders.
Use this code to list your stores.
Sub FindYourStore() Dim colStores As Outlook.Stores Dim oStore As Outlook.store On Error Resume Next Set colStores = Application.Session.Stores 'You may use Session.Stores as shortcut For Each oStore In colStores Debug.Print oStore.DisplayName Next End Sub
With the name of the Outlook store, you plug that into the next subroutine. In my case, I was using this routine to parse emails in this folder. This routine will list the subject lines of every email in the designated search folder.
THIS CODE ONLY WORKS WITH SEARCH FOLDERS.
Sub ListSubjectLinesOfEmailsInASearchFolder() Dim StoreName As String Dim FolderName As String StoreName = "firstname.lastname@example.org" FolderName = "Pending Terminations" Dim colStores As Outlook.Stores Dim oStore As Outlook.store Dim oSearchFolders As Outlook.Folders Dim oFolder As Outlook.Folder Dim mail As Outlook.MailItem On Error Resume Next Set oFolder = Session.Stores.Item(StoreName).GetSearchFolders(FolderName) For Each mail In oFolder.Items Debug.Print mail.Subject Next End SubI hope that helps someone else out there.