例: Onselect event

この Onselect イベントは、新しく選択された文書を検査し、作成された日付以後に文書が変更された場合、警告を出します。グローバル変数 lastCaretID は、文書が新しく選択されたかどうかを判別するときに使用されます。

REM Globals
Dim lastCaretID As Variant
lastCaretID = "000"
Sub Onselect(Source As Notesuiview)
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Set db = session.CurrentDatabase 
    caretNoteID$ = Source.CaretNoteID
    If lastCaretID <> caretNoteID$ Then   ' we only process if the highlighted row has changed
        lastCaretID = caretNoteID$
        noteID$ = "NT00000" + caretNoteID$
        Set doc = db.GetDocumentByID( caretNoteID$ )
        moddate$ = Strleft(doc.LastModified, " ") ' we only care about the date
        createdate$ = Strleft(doc.Created, " ")
        If moddate$ > createdate$ Then 
            Messagebox "This document has been modified since it was created",, _
            "Modification alert"
        End If
    End If
End Sub