Examples: QueryClose event

  1. This script asks users if they're sure they want to exit the current document. If they click the Yes button, the document closes; if they click No, the document remains open.

    In order to use the constants associated with the Messagebox function, this script must include the file LSCONST.LSS.

    %INCLUDE "lsconst.lss"
    Sub Queryclose(Source As Notesuidocument, _
    Continue As Variant)
      Dim answer As Integer
      answer = Messagebox _
      ( "Do you want to exit this document?", _
      MB_YESNO, "Document" )
      If ( answer = IDNO ) Then
        continue = False
      End If
    End Sub
  2. If a user has been editing the current document and closes it, Notes® first asks if the user wants to save the document. Regardless of the response, this script then asks if the user wants to mail the document. If the user clicks the Yes button, the document gets mailed to whomever is listed in the SendTo field.

    In order to use the constants associated with the Messagebox function, this script must include the file LSCONST.LSS.

    %INCLUDE "lsconst.lss"
    Sub Queryclose(Source As Notesuidocument, Continue As Variant)
      Dim answer As Integer
      If source.EditMode Then
        answer = Messagebox _
        ("Do you want to mail this doc?", MB_YESNO, "Mail" )
        If ( answer = IDYES ) Then
          Call source.Send
        End If        
      End If
    End Sub