Examples: ModifiedSinceSaved property
This script saves a document if it contains unsaved changes, then closes the document.
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
If uidoc.ModifiedSinceSaved Then
Call uidoc.Save
End If
Call uidoc.Close
End Sub