[AccessD] Deleting Outlook Contacts

jwcolby jwcolby at colbyconsulting.com
Fri Sep 10 08:07:22 CDT 2010


 > The collection has a Count property, so  just use it in a for loop that runs backwards..

If that is the case, the much simpler

while olcontacts.count
	olcontacts(0).Delete should work.
wend

John W. Colby
www.ColbyConsulting.com

On 9/10/2010 9:02 AM, Heenan, Lambert wrote:
> Close Charlotte, but no prize :-)
>
> The collection has a Count property, so  just use it in a for loop that runs backwards..
>
> Dim n as Long
>
>      ' delete all the current contacts
>      Set olContacts = olFolder.Items
>
>      Me.Repaint
>      For N = olContacts.Count- 1 to 0 Step -1 '<- Seems many people forget the optional Step clause of a FOR statement
> 	   Me.txtProcessing = "Deleting..."&  olContacts.Count
>          olContacts(n).Delete
>          DoEvents
>      Next
>
> Lambert



More information about the AccessD mailing list