ThrottleWorks
Excel Ninja
Hi,
I want to use restrict function to filter today's e-mails. I have never tried this function before. Tried Google but not able to do it.
Can anyone please guide me, how should I apply restrict function in below mentioned code.
I want to use restrict function to filter today's e-mails. I have never tried this function before. Tried Google but not able to do it.
Can anyone please guide me, how should I apply restrict function in below mentioned code.
Code:
Sub SendASN()
Dim myFolder As MAPIFolder
Dim sFilter As String
Dim ItemsToProcess As Outlook.Items
Dim myItem As MailItem, myForwardItem As MailItem
Dim MyRecipient As String
Set myFolder = Session.GetDefaultFolder(olFolderInbox)
'I want to use restrict function in this code
'Criteria is today's date - email date = 0 then
sFilter = (VBA.DateValue(VBA.Now) - Items.ReceivedTime = 0)
Set ItemsToProcess = Session.GetDefaultFolder(olFolderInbox).Items.Restrict(sFilter)
For Each myItem In ItemsToProcess
If VBA.DateValue(VBA.Now) - Items.ReceivedTime = 0 Then
MsgBox "Yo"
End If
Next
End Sub