title: Select Outlook Folder With Excel VBA
body: <p>I'm trying to bypass having to select the folder I want and just tell Excel to go ahead and count the "Inbox"</p>
  
  <pre><code>Sub Get_Emails()
  
  Dim OLF As Outlook.MAPIFolder
  Dim EmailItemCount As Long
  
  Set OLF = GetObject("", "Outlook.Application").GetNamespace("MAPI").PickFolder
  EmailItemCount = OLF.Items.Count
  
  Range("A1") = EmailItemCount
  
  Set OLF = Nothing
  
  Application.StatusBar = False
  
  End Sub
  </code></pre>
  
  <p>Does anyone know how I can just get the count without having to select the folder? Excel VBA should just automatically go into the "Inbox" and give me my count.</p>
  
  <p>Note: You have to go to Tools > References > and select "Microsoft Outlook 14.0 Object Library" in order for this macro to work.</p>