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 to delete messages with given subject after message expires



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 8th 08, 11:55 PM posted to microsoft.public.outlook.program_vba
Sami[_2_]
external usenet poster
 
Posts: 2
Default Macro to delete messages with given subject after message expires

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,
Ads
  #2  
Old September 9th 08, 08:11 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Macro to delete messages with given subject after message expires



You might adapt this sample:
http://www.vboffice.net/sample.html?...cmd=showite m

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:

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,

 




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
Enable Expires After on a message [email protected] Outlook - General Queries 1 July 5th 07 01:40 AM
Message Expires WildPacket Outlook - General Queries 2 April 16th 07 06:19 PM
Macro to extract subject and sender name of messages in folder to Excel file bony_tony Outlook and VBA 0 March 7th 07 02:16 AM
Outlook Macro to Modify Subject and Send Message jaysonsch Outlook and VBA 4 September 27th 06 06:48 AM
New message To, CC, BCC and Subject fields don't accept 'delete' [email protected] Outlook - General Queries 3 May 25th 06 08:34 PM


All times are GMT +1. The time now is 08:16 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.