I am using vba from excel to search my default outlook inbox for emails that contain "Weekly Op's Report for" on the subject line and transfer to excel. How can I modify my code to meet to conditions: if subject line reads "Weekly Op's Report for" and Received date = today then copy email body. Here is my code below:
Sub GetFromInbox()
Dim olApp As Outlook.Application
Dim olNs As Outlook.Namespace
Dim olFldr As Outlook.MAPIFolder
Dim olItms As Outlook.Items
Dim olMail As Variant
Dim i As Long
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set olFldr = olNs.GetDefaultFolder(olFolderInbox)
Set olItms = olFldr.Items
olItms.Sort "Subject"
i = 1
For Each olMail In olItms
If InStr(1, olMail.Subject, "Weekly Op's Report for ") > 0 Then
ThisWorkbook.Sheets("tester").Cells(i, 1).Value = olMail.Body
i = i + 1
End If
Next olMail
Set olFldr = Nothing
Set olNs = Nothing
Set olApp = Nothing
End Sub