title: Set reference to PST folders
body: <p>I have several PST files open in my Outlook and I need to list all the mails within these PST in Excel.</p>
  
  <p>My code lists the mails within my Inbox, and I can't find how to search within all the opened PST.</p>
  
  <p>Here is the structure of my Outlook:</p>
  
  <ul>
  <li><p>Inbox</p>
  
  <ul>
  <li>Draft</li>
  <li>Deleted items</li>
  <li>Junk emails</li>
  <li>etc.</li>
  </ul></li>
  <li><p>Budget</p></li>
  <li>Stock</li>
  <li>Country</li>
  <li>Old</li>
  <li>etc.</li>
  </ul>
  
  <p>I need to search within the other folders (Budget, Stock, Country...).</p>
  
  <p>Here is my code:</p>
  
  <pre><code>Sub List_mails()
  
  Dim olapp As New Outlook.Application
  Dim ns As Object, Dossier As Object
  Dim OlExp As Object
  Dim i As Object
  Dim mybody() As String
  Dim fromsender As String
  
  Set ns = olapp.GetNamespace("MAPI")
  Set Dossier = ns.GetDefaultFolder(olFolderInbox)
  b = 2
  For Each i In Dossier.Items
      Cells(b, 1) = i.Subject
      Cells(b, 2) = i.ReceivedTime
      Cells(b, 3) = i.SenderEmailAddress
      b = b + 1
  Next i
  End Sub
  </code></pre>