Macro to delete messages with given subject after message expires

  • Thread starter Thread starter Sami
  • Start date Start date
S

Sami

My company sends out a cafe special each day to all mailboxes complete with
picture that is filling up my Exchange server. The messages are set to expire
one day after they are sent.

I am hoping that a macro can be created (I am not a programmer, so help is
appreciated!) that will delete these messages that all have the same subject
line if a message has an expiration date that has passed.

Thanks,
 
You might adapt this sample:
http://www.vboffice.net/sample.html?mnu=2&pub=6&lang=en&smp=51&cmd=showitem

It deletes every item from the current folder. Before actually calling
Items.Remove i, you may check the item's ExpiryDate:

Dim obj as MailItem
Set obj=Items(i)
If dateDiff("d", obj.ExpiryDate, date) > 0 then
obj.Delete
Endif

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Mon, 8 Sep 2008 14:55:01 -0700 schrieb Sami:
 
Back
Top