This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
How to Delete Docs in a Collection You Are Traversing
I know the original thread is talking about COM, but here is how I do it in regular code. The way to avoid the error is to set a temporary NotesDocument object to the next doc in the collection, and then reset your main doc object to that temp doc at the bottom of the loop. See below.
Dim dc As NotesDocumentCollection, doc As NotesDocument, docTemp as NotesDocument
' Set dc, then...
Set doc = dc.GetFirstDocument()
Do While Not (doc Is Nothing)
Set docTemp = dc.GetNextDocument(doc)
' Execute code that deletes doc.
Set doc = docTemp
Loop
Feedback response number WEBB9N6SLH created by ~Lex Minreteroni on 08/20/2014