Macro for deleting email by date

D

dcallaway

what would the code be for writing a macro to auto delte emails older than 7
days?
 
M

Michael Bauer [MVP - Outlook]

Please see the sample for the Restrict function in your VBA help file. You
can loop backwards through the resulting Items collection and call each
item's Delete method. A backwards loop looks like this:

Dim i&
Dim Items as Outlook.Items
Dim obj as Object

For i=Items.Count to 1 Step-1
set obj=Items(i)
obj.Delete
Next

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Thu, 27 Sep 2007 14:34:00 -0700 schrieb dcallaway:
 
Top