title: Exporting emails from an Outlook subfolder to Excel
body: <p>I've found a VBA macro that takes e-mails from Outlook and put them into cells in Excel. 
  The code works, but  I want to tell Excel only to get e-mails from a specific subfolder. In my Inbox-folder I have a subfolder called Info. I want to be able to get e-mails from this subfolder.</p>
  
  <p>This is the code that I have now:</p>
  
  <pre><code>Sub Download_Outlook_Mail_To_Excel()
  'Add Tools-&gt;References-&gt;"Microsoft Outlook nn.n Object Library"
  'nn.n varies as per our Outlook Installation
  Dim folders As Outlook.folders
  Dim folder As Outlook.MAPIFolder
  Dim iRow As Integer
  Dim Pst_Folder_Name
  Dim MailboxName
  
  
  
  'Mailbox or PST Main Folder Name (As how it is displayed in your Outlook Session)
  MailboxName = "My email address"
  
  'Mailbox Folder or PST Folder Name (As how it is displayed in your Outlook Session)
  Pst_Folder_Name = "Inbox"
  
  Set folder = Outlook.Session.folders(MailboxName).folders(Pst_Folder_Name)
  If folder = "" Then
      MsgBox "Invalid Data in Input"
      GoTo end_lbl1:
  End If
  
  'Rad Through each Mail and export the details to Excel for Email Archival
  Sheets(1).Activate
  
  For iRow = 1 To folder.Items.Count
      Sheets(1).Cells(iRow, 1).Select
      Sheets(1).Cells(iRow, 1) = folder.Items.Item(iRow).SenderName
      Sheets(1).Cells(iRow, 2) = folder.Items.Item(iRow).Subject
      Sheets(1).Cells(iRow, 3) = folder.Items.Item(iRow).ReceivedTime
      Sheets(1).Cells(iRow, 4) = folder.Items.Item(iRow).Size
      Sheets(1).Cells(iRow, 5) = folder.Items.Item(iRow).SenderEmailAddress
      'Sheets(1).Cells(iRow, 6) = Folder.Items.Item(iRow).Body
  Next iRow
  MsgBox "Outlook Mails Extracted to Excel"
  
  end_lbl1:
  
  End Sub
  </code></pre>
  
  <p>How can I make sure that it gets emails from the subfolder, and not the mainfolder? </p>