title: Is it possible to find related emails and loop the results in the background?
body: <p>I'd like to find related emails to the email I have currently selected. Then I want to loop the results.</p>
  <p>Using the <code>ActiveExplorer.Search</code> takes a moment, and at the same time the code keeps running. So it doesn't return any results, because of loading still happening in the background, I guess.</p>
  <p>So my questions are:</p>
  <ul>
  <li>How do I find related emails?</li>
  <li>How do I loop the search results (in the background)?</li>
  </ul>
  <p>To find related emails, maybe something like this:</p>
  <pre><code>Sub FindRelatedEmails()
      Dim ns As Outlook.NameSpace
      Set ns = myOlApp.GetNamespace(&quot;MAPI&quot;)
      
      Dim oMail As Outlook.MailItem
      Set oMail = ActiveExplorer.Selection.Item(1)
      
      Dim strFrom As String
      strFrom = oMail.SenderName
      
      Dim strSubject As String
      strSubject = oMail.ConversationTopic
      
      Dim myOlApp As New Outlook.Application
      Set myOlApp.ActiveExplorer.CurrentFolder = ns.GetDefaultFolder(olFolderInbox)
       
      Dim txtSearch As String
      txtSearch = &quot;[Konversation]:=&quot;&quot;&quot; &amp; strSubject &amp; &quot;&quot;&quot;&quot;
      
      myOlApp.ActiveExplorer.Search txtSearch, olSearchScopeAllFolders
      
      ' Problem occurs below, since the code keeps running but the search results haven't loaded yet.
      myOlApp.ActiveExplorer.SelectAllItems
      
      Dim i As Long
      For i = ActiveExplorer.Selection.Count To 1 Step -1
          Dim Item As MailItem
          Set Item = ActiveExplorer.Selection.Item(i)
          Debug.Print Item.Subject, Item.Sender, Item.Parent.FolderPath
      Next
      
      Set ns = Nothing
      Set oMail = Nothing
      Set myOlApp = Nothing
      Set Item = Nothing
  End Sub
  </code></pre>