Occurs when a page is closed.
Private Sub expression_OnPageClose(ByVal pPage As PageWindowEx, Cancel As Boolean)
expression The variable name of an object of type Application declared using the WithEvents keyword in a class module.
pPage Required PageWindowEx. The specified PageWindowEx object.
Cancel Required Boolean. Causes Microsoft FrontPage to abort the close when set to True. When Cancel is programmatically set to True, the user can abort the save process by clicking the Cancel button on the form. Default is False.
Remarks
The OnPageClose event is associated with the Application object. When the user closes a PageWindowEx object, the OnPageClose event fires and executes the code within the event procedure.
Example
The following example uses the IsDirty property to check if a page has been modified, and if it has saves the page before closing it.
Note To run this example, you must have at least one open Web site and one open page within that Web site.
Create a form called frmLaunchEvents.frm and add two buttons, a button called cmdClosePage,
and a button called cmdCancel
. Add the following code to the form code window.
Option Explicit
Private WithEvents eFPApplication As Application
Private pPage As PageWindowEx
Private Sub UserForm_Initialize()
Set eFPApplication = New Application
End Sub
Private Sub cmdClosePage_Click()
ActivePageWindow.Close
End Sub
Private Sub cmdCancel_Click()
'Hide the form.
frmLaunchEvents.Hide
Exit Sub
End Sub
Private Sub eFPApplication_OnPageClose(ByVal pPage As _
PageWindowEx, Cancel As Boolean)
If pPage.IsDirty = True Then pPage.Save
End Sub