title: How to iterate through only mails of a specific date and not the entire folder in outlook vba
body: <p>I have a requirement to iterate through inbox and more specifically only today's mails.</p>
  
  <p>Using the following code I am able to iterate through inbox and run another function only if the received date is today. </p>
  
  <p>I want to know if there is any other way of iterating only through today's mail instead of going through the entire inbox (as the inbox of the end user has lot of mails and the current code takes a lot of time). Thanks in advance! </p>
  
  <pre><code>For Each item In olFolder.Items
      If TypeOf item Is Outlook.MailItem Then
          Dim oMail As Outlook.MailItem: Set oMail = item
              MsgBox Format(oMail.ReceivedTime, "Short Date")
  
              recDate = Format(oMail.ReceivedTime, "Short Date")
              If recDate = Date Then
                  MsgBox "Today's mail"
                  Call CopyToServer(oMail)
              End If
  
      End If
  Next
  </code></pre>