Examples: QueryOpenDocument event

This example stores the user's "work area" in a variable that is global to the NotesUIView scripts. When the user tries to open a document in the view, the QueryOpenDocument event checks the document's category. Documents where the category is not identical to the user's work area are not opened.

(Declarations)
Dim workArea As String
Sub Postopen(Source As Notesuiview)
  workArea = Inputbox ("What is your work area?", _
  "Work area", "Marketing")
End Sub
Sub Queryopendocument(Source As Notesuiview, Continue As Variant)
  Dim docs As NotesDocumentCollection
  Dim doc As NotesDocument
  Set docs = Source.Documents
  Set doc = docs.GetFirstDocument
  If Ucase (doc.Categories(0) ) <> Ucase (workArea) Then
    Continue = False
  End If
End Sub