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

verify and delete mailitem



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7  
Old June 13th 06, 12:10 PM posted to microsoft.public.outlook.program_vba
Joanne
external usenet poster
 
Posts: 12
Default verify and delete mailitem

Sue
Thanks so much for your input on my little project. I always have
great appreciation for the time and expertise you mvps donate to us
wannabes.
Your code is so precise - I love it.
Also, have spent much time on your outlookcode.com - will spend much
more also - so much to learn and absorb from there.
Keep up the great work

I'm a big fan of this newsgroup
Joanne

Sue Mosher [MVP-Outlook] wrote:

Selection.Find is Word's method for searching inside text. Inside an Outlook item, you would use the Instr() function to test for a match inside the MailItem.Body

If Instr(obj.Body, "Description: Successful" 0 Then
obj.Delete
End If

The tricky part is how your construct the loop. Because the index changes each time you delete an item, you can't use a For Each ... Next loop, but can instead us a countdown loop:

count = Items.Count
For i = count to 1 Step -1
Set obj = Items(i)
If Instr(obj.Body, "Description: Successful" 0 Then
obj.Delete
End If
Next

You can put the code in ThisOutlookSession or create a new module, which would make it easier to export for backup.



 




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
Restricted access; verify credentials BEEP Outlook - Calandaring 0 May 16th 06 03:29 PM
verify that an email was read without using a receipt RCNellis Outlook - General Queries 1 May 12th 06 04:02 PM
Need to verify TO recipient [email protected] Outlook - Using Forms 2 April 19th 06 10:38 PM
how do you verify credentials roger Outlook - Calandaring 1 March 2nd 06 04:13 PM
How can I create a MailItem that displays like a received MailItem ? Clive Outlook - Using Forms 0 February 27th 06 04:14 PM


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