A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Macro for deleting email by date



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 27th 07, 11:34 PM posted to microsoft.public.outlook.program_vba
dcallaway
external usenet poster
 
Posts: 1
Default Macro for deleting email by date

what would the code be for writing a macro to auto delte emails older than 7
days?
Ads
  #2  
Old September 28th 07, 08:31 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Macro for deleting email by date



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:

what would the code be for writing a macro to auto delte emails older than

7
days?

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
When deleting an email, it's so fast, it deletes the next email t. Kathy Outlook - General Queries 3 April 19th 07 11:40 PM
Calcualting the time between email received date and reply date Shanks Outlook - General Queries 3 February 22nd 07 04:11 AM
Deleting email m federko Outlook Express 4 August 19th 06 08:50 PM
Simple date/time stamp macro for notes area? c mateland Outlook and VBA 2 August 1st 06 04:55 AM
Deleting a sent email Elizabeth Outlook - General Queries 4 January 16th 06 04:17 PM


All times are GMT +1. The time now is 08:09 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.