Edit all document in a view

OK I need some help on this Agent. I need this agent to cycle through every document in a view and bring up each document in edit mode,yes I want the document to come up in edit mode, so I can see it (don’t ask) run the code , save and close the document go on to the next document. Every collection I build it just keeps on bringing up the same document and doesn’t go on to the next document. Below is about my 100th attempt.

Thanks in advance

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim DocvivewCollection As NotesViewEntryCollection

Dim Doc As NotesDocument

Dim entry As NotesViewEntry

Dim uidoc As NotesUIDocument



Set db = session.CurrentDatabase

Set view = db.GetView( "test" )

Set DocviewCollection = view.AllEntries

Set entry = DocviewCollection.GetFirstEntry()



While Not (entry Is Nothing)

Running some code.

	Set uidoc = ws.CurrentDocument

	Set uidoc=ws.EditDocument

	Call uidoc.Save

	Call uidoc.Close(True)

	

	Set entry = docviewCollection.GetNextEntry(entry)

Wend

Subject: Edit all document in a view

Your code is always referencing the same document (the uidocument) which is why it’s always the same. Try this in your loop…


Set entry = DocviewCollection.GetFirstEntry()

While Not (entry Is Nothing)

if entry.IsValid Then

  if entry.IsDocument Then

     Set doc = entry.Document

     Set uidoc = ws.EditDocument(True, Doc, False)

     Call uidoc.Save

     Call uidoc.Close(True)

  End If

End If

Set entry = docviewCollection.GetNextEntry(entry)

Wend

I haven’t test the above code so you may need to tweak it a bit.

Alex