title: My VBA loop is not starting at the beginning of a subfolder in Outlook
body: <p>I have the below code that runs through a folder looking for unread messages from a specific person with a specific subject. The loop is not beginning at the most recent emails. It's beginning a month ago where all the messages are read.</p>
  
  <pre><code>Sub MovingAttachmentsIntoNetworkFolders()
  Dim olApp As Outlook.Application
  Dim objNS As Outlook.NameSpace
  Dim olFolder As Outlook.MAPIFolder
  Set olApp = Outlook.Application
  Set objNS = olApp.GetNamespace("MAPI")
  Set olFolder = objNS.GetDefaultFolder(olFolderInbox).Folders("Email Subfolder") 'Specify Folder here
  
  On Error GoTo ErrorHandler
  
  For Each Item In olFolder.Items
      Debug.Print Item.ReceivedTime
      If Item.UnRead = True Then
          If TypeOf Item Is Outlook.MailItem Then
              Dim oMail As Outlook.MailItem: Set oMail = Item
  
              Debug.Print Item.SenderEmailAddress
              Debug.Print Item.Subject
              Debug.Print Item.Attachments.Count
  
              If Item.Sender = "emailaddress@email.com" And _
              Item.Subject = "EmailSubject" And _
              Item.Attachments.Count = 1 Then
              'Set folder to save in.
                  Dim olDestFldr As Outlook.MAPIFolder
                  Dim myAttachments As Outlook.Attachments
                  Dim Att As String
  
              'location to save in.  Can be root drive or mapped network drive.
                  Const attPath As String = "mappednetworkdrive"
  
              ' save attachment
                  Set myAttachments = Item.Attachments
                  Att = myAttachments.Item(1).FileName
                  Debug.Print Att &amp; "\" &amp; Format(Item.ReceivedTime, "mm-dd-yyyy")
                  myAttachments.Item(1).SaveAsFile Format(Item.ReceivedTime, "mm.dd.yyyy") &amp; " " &amp; Att
  
              ' mark as read
                  Item.UnRead = False
              End If
          End If
      End If
  Next
  
  ProgramExit:
    Exit Sub
  
  ErrorHandler:
    MsgBox Err.Number &amp; " - " &amp; Err.Description
    Resume ProgramExit
  
  End Sub
  </code></pre>
  
  <p>Any reason why my code is behaving this way?</p>