Dim NUIWS As New NotesUIWorkspace
Dim NV As NotesView
Dim NVN As NotesViewNavigator
Dim NVE As NotesViewEntry
Dim strCaretCategory As String
Dim blnContains As Boolean
blnContains = False
strCaretCategory = NUIWS.CurrentView.CaretCategory
Set NV = NUIWS.CurrentView.View
Set NVN = NV.CreateViewNav()
Set NVE = NVN.GetFirst
Dim collection As NotesDocumentCollection
Set collection = NV.Parent.Search( "" , Nothing , 0 )
Do While Not(NVE Is Nothing)
If Instr(NVE.GetPosition("."), strCaretCategory)=1 Then
blnContains = True
If NVE.IsDocument Then
On Error 4469 Resume Next
Call collection.AddDocument( nve.Document )
End If
Elseif blnContains Then
Exit Do
End If
Set NVE = NVN.GetNext(NVE)
Loop
' If collection.count > 0 Then Call collection.RemoveAll( True )
Messagebox(collection.count )
Call NUIWS.ViewRefresh()