Outlook VBA Date Time filter
I have an outlook macro that reads the all the Subject lines of all unread emails.
Sub ReadMails()
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
Set objFolderSrc = objFolder.Folders("My Own Folder")
Dim Subjects() As String
ReDim Subjects(1 To 1) As String
Set colItems = objFolderSrc.Items
Set colFilteredItems = colItems.Restrict("[UnRead] = False")
For Each objMessage In colFilteredItems
Subjects(UBound(Subjects)) = objMessage.ConversationTopic
ReDim Preserve Subjects(1 To UBound(Subjects) + 1) As String
Next
End Sub
Instead I need to read the emails that have come between current time and 8 AM in the morning of the same day.
How do I add that filter?
olFolderInbox is the folder where all received emails go to. This is the root inbox folder. This is not a concern; that part works.