OnClose Event

Microsoft FrontPage Visual Basic

Show All Show All

OnClose Event

ShowOnClose event as it applies to the PageWindowEx object.

Occurs when the active page window is closed by the user.

Private Sub expression_OnClose(Cancel As Boolean)

expression     A variable name which references an object of type PageWindowEx declared using the WithEvents keyword in a class module.

Cancel       A Boolean that determines if the operation will be cancelled. True cancels closing the active page window.

ShowOnClose event as it applies to the WebEx object.

Occurs when the active Web site window is closed by the user.

Private Sub expression_OnClose(pCancel As Boolean)

expression     A variable name which references an object of type WebEx declared using the WithEvents keyword a class module.

Cancel     A Boolean that determines if the operation will be cancelled. True cancels closing the active Web site.

Example

The following example prompts the user before closing the active page window. If the user clicks No, the window will not close.

Private Sub PageWindowEx_OnClose(Cancel As Boolean)
'Displays a message

    Dim strAns As String
    'Prompt user
    strAns = MsgBox("Are you sure you want to close the active page window?", _
                    vbYesNo)
    If strAns = vbYes Then
        Cancel = False
    Else
        Cancel = True
    End If

End Sub