Lotus Notes FAQ Visit Our Sponsor!

How do you operate on the currently selected documents in LotusScript?

To determine the currently selected document in a view you have to traverse it with the NotesDatabase property:UnprocessedDocuments which returns a document collection that you can examine.
The ... part in the code below marks where you can put code to access the active document. This may look strange, but it actually only returns the document that you currently stand on (unless you have marked a set of documents).

  Dim workspace As New notesuiworkspace
  Dim uidoc As notesuidocument
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim collection As NotesDocumentCollection
  Dim doc As NotesDocument
  Set db = session.CurrentDatabase
  Set collection = db.UnprocessedDocuments
  If (Not collection Is Nothing) Then
    For i = 1 To collection.Count
      Set doc = collection.GetNthDocument(i)
      ...
    Next
  End If


Applies to Notes Versions: 4, 4.5, 4.6, 5
Last Modified: January 23, 1998