S
Steve Roberts
When I run the code below it seems to work fine. But when I look in my inbox
I still see an item with a date of 10/14/2003 which should have been moved.
When I look at the properties of the email I notice that the Received date
is 10/14/2003 but the modified date is 11/4/2003. This is because that is
the date I put it back into my inbox. So my problem is the code seems to
refer to the modified date instead of the actual Date Received. Any
Suggestions on how to fix it?
Thanks in advance for any suggestions you may have.
Sub MoveByDate()
Set myOlApp = CreateObject("Outlook.Application")
Set MyNameSpace = myOlApp.GetNamespace("MAPI")
Set myfolder = MyNameSpace.GetDefaultFolder(olFolderInbox)
Set myItems = myfolder.Items
Set myRestrictItems = myItems.Restrict("[ReceivedTime] < '10/21/2003'")
For Each myitem In myRestrictItems
myitem.Move myfolder.Folders("archive")
Next
End Sub
I still see an item with a date of 10/14/2003 which should have been moved.
When I look at the properties of the email I notice that the Received date
is 10/14/2003 but the modified date is 11/4/2003. This is because that is
the date I put it back into my inbox. So my problem is the code seems to
refer to the modified date instead of the actual Date Received. Any
Suggestions on how to fix it?
Thanks in advance for any suggestions you may have.
Sub MoveByDate()
Set myOlApp = CreateObject("Outlook.Application")
Set MyNameSpace = myOlApp.GetNamespace("MAPI")
Set myfolder = MyNameSpace.GetDefaultFolder(olFolderInbox)
Set myItems = myfolder.Items
Set myRestrictItems = myItems.Restrict("[ReceivedTime] < '10/21/2003'")
For Each myitem In myRestrictItems
myitem.Move myfolder.Folders("archive")
Next
End Sub