![]() If MinDate = vbEmpty Then MinDate = Date - 7 ![]() Sub RemoveDuplicates(Optional TargetFolder As Folder, Optional MinDate As Date) They default to the currently visible folder and seven days ago. The following will keep the MailItem with the oldest date and delete more recent ones with the same subject.įor convenience TargetFolder and MinDate are configurable but optional. If Not oItems("ReceivedTime") Is Nothing ThenĬMail.Add oItems("Subject"), oItems("Subject")ĭebug.Print Err.Number, oItems("Subject"), oItems("ReceivedTime") Sub RemoveDuplicates()ĭim oEmail As MailItem, oItems As ItemProperties, oItem As ItemProperty It's counting in descending order and I can't seem to get the sorting of the items to work.īasically I need help figuring out how to make sure the "newest" duplicate by received time gets deleted. ![]() ![]() This code works but is deleting the oldest duplicates. Im trying to create a VBA macro that checks if there is a duplicate mail (looks at subject) and then deletes the mail. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |