deleting appointmets in 1 specific month

  • Thread starter Thread starter Filips Benoit
  • Start date Start date
F

Filips Benoit

Dear All,

The code below does not run always correctly.
Somethimes appointments in the specific month has not been deleted !

Can't see why!

'Delete all appointment in this month
For Each objAppointement In myNewFolder.Items
If Month(objAppointement.Start) = iMonth And
Year(objAppointement.Start) = iYear Then objAppointement.Delete
DoEvents
Next

Thanks,

Filip
 
Without any reason the action leaves the loop and stops deleting items befor
the end of the appointmentcollection.
If I run the loop twice it deletes more appointments but not all in the
specific month.
Another run may be perfect!

VERRY STRANGE !!

Filip

"Filips Benoit" wrote in message
Dear All,

The code below does not run always correctly.
Somethimes appointments in the specific month has not been deleted !

Can't see why!

'Delete all appointment in this month
For Each objAppointement In myNewFolder.Items
If Month(objAppointement.Start) = iMonth And
Year(objAppointement.Start) = iYear Then objAppointement.Delete
DoEvents
Next

Thanks,

Filip
 
You need to step backwards - when you move forward you'll skip every
other appt. to do this you need to get a count of appt first then run
through them backwards:


For i = [#of appt] To 1 Step -1

[delete appts]

Next i

Diane Poremsky [MVP - Outlook]

Outlook & Exchange Solutions Center: http://www.slipstick.com/
OutlookForums http://www.outlookforums.com
 
Back
Top