Select / activate first email item in the searched query

Bamerand

Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
Dear all,

I am currently using the code as follows to search for any emails that were sent / received during a certain period. So far so good. Now, how can I select and activate first email found in the chain of emails? Screenshot attached.


Private Sub Emails()
CreateObject("WScript.Shell").PopUp "The emails sent", &H0 + &H0
Dim myOlApp As New Outlook.Application
txtSearch = "sent: (" & "27-10-2018" & "" & ".." & "" & Date & ")"
myOlApp.ActiveExplorer.Search txtSearch, olSearchScopeAllFolders
Set myOlApp = Nothing
End Sub

Post.png
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
The AdvancedSearchComplete event gives you with SearchObject.Results the list of found items. Pass the first one to ActiveExplorer.AddToSelection
 

Similar threads

Top