J
Jed_Klampett
I have duplicate messages in a folder called "Dupes" I want to sort by
ReceivedTime, then loop through if subject and received time are the
same. Anyway, sort doesn't work here. Only think I can think of is
maybe there is more than one items collection somehow (got that from
Sue Mosher's posts *thanks*). Any ideas? Thanks. -Noelani Rodriguez
-----------------------
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objInbox = objNameSpace.GetDefaultFolder(olFolderInbox)
Set objFolder = objInbox.Folders("Dupes")
objFolder.Items.Sort "[ReceivedTime]", True
'Read through all items and filter as necessary
For i = 1 To objFolder.Items.Count
Set objMail = objFolder.Items(i)
'Check for duplicates
If objMail.Subject = LastItemName And objMail.ReceivedTime =
LastReceivedTime Then
objMail.Delete
End If
LastItemName = objMail.Subject
MsgBox (LastItemName)
LastReceivedTime = objMail.ReceivedTime
MsgBox (LastReceivedTime)
Next i
ReceivedTime, then loop through if subject and received time are the
same. Anyway, sort doesn't work here. Only think I can think of is
maybe there is more than one items collection somehow (got that from
Sue Mosher's posts *thanks*). Any ideas? Thanks. -Noelani Rodriguez
-----------------------
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objInbox = objNameSpace.GetDefaultFolder(olFolderInbox)
Set objFolder = objInbox.Folders("Dupes")
objFolder.Items.Sort "[ReceivedTime]", True
'Read through all items and filter as necessary
For i = 1 To objFolder.Items.Count
Set objMail = objFolder.Items(i)
'Check for duplicates
If objMail.Subject = LastItemName And objMail.ReceivedTime =
LastReceivedTime Then
objMail.Delete
End If
LastItemName = objMail.Subject
MsgBox (LastItemName)
LastReceivedTime = objMail.ReceivedTime
MsgBox (LastReceivedTime)
Next i