次の例は、「ProgWork2」という名前のデータベースの [By Author] ビューにある文書を、モーダルウィンドウで表示します。次いで、選択リストの Subject アイテムを表示します。Sub Click(Source As Button)
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim item As NotesItem
Set db = session.CurrentDatabase
Set collection = workspace.PickListCollection( _
PICKLIST_CUSTOM, _
True, _
"snapper", _
"ProgWork2", _
"By Author", _
"My Dialog", _
"Please select a document or two." )
If collection.Count = 0 Then
Messagebox "User canceled" ,, _
"Subject item on the document(s)"
Else
Set doc = collection.GetFirstDocument
While Not ( doc Is Nothing )
Set item = doc.GetFirstItem( "Subject" )
If ( item Is Nothing ) Then
messagelist = messagelist & "None" & Chr(10)
Else
messagelist = messagelist & item.Text & Chr(10)
End If
Set doc = collection.GetNextDocument (doc)
Wend
Messagebox messagelist ,, _
"Subject item on the document(s)"
End If
End Sub