![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Thanks Ken, I guess it is similar to deleting rows in Excel. I will change
it to a down counter. Cheers "Ken Slovak - [MVP - Outlook]" wrote: Don't use For Each loops or up counting For loops for deleting items from a collection. Use For loops that count down (Step -1) or use Do loops that test for no items left. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Nigel RS" wrote in message ... The following snippet of VBA code (Outlook 2003) is used to selectively delete mail items from a selected mail folder. where the mail item subject matches a predefined string (MailSubject). This code works great except it fails to delete the last item. If there are 10 items matching it will delete 9 but leave one behind. If there is only 1 it fails to delete it. If I step the code in the debugger it works! What could be causing this? For Each objItem In objFolder.Items ' delete the item from the folder If Left(objItem.Subject, mSubLen) = MailSubject Then objItem.Delete End If Next |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
deleting items | Dan D. | Outlook - Calandaring | 2 | September 29th 08 04:58 PM |
Deleting individual mail items from Outlook 2007 archive | beemer | Outlook - General Queries | 6 | May 7th 08 12:40 PM |
Can I prevent others from deleting calendar items? | dlongley | Outlook - Calandaring | 4 | March 27th 08 03:44 PM |
Deleting sent items from outlook 2003 | curtis888 | Outlook and VBA | 2 | May 4th 07 04:49 PM |
Deleting calendar items should ask "all past and future items" | katie | Outlook - Calandaring | 0 | April 4th 06 03:52 AM |