OnAfterPageSave Event

Microsoft FrontPage Visual Basic

Occurs after a page is saved.

Private Sub Application_OnAfterPageSave(ByVal pPage As PageWindowEx, Success As Boolean)

pPage    Required PageWindowEx object.

Success   Required Boolean. True if the PageWindowEx object was successfully saved.

Remarks

The OnAfterPageSave event is associated with the Application object. After the user saves a page or closes Microsoft FrontPage, the OnAfterPageSave event fires and executes the code that you specified within the event procedure.

Example

The following example displays a message box after the page has been saved and displays the file name of the page.

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 cmdSave and a button called cmdCancel. Add the following code to the form code window.

Option Explicit
Private WithEvents eFPApplication As Application
Private Sub UserForm_Initialize()
    Set eFPApplication = New Application
End Sub
Private Sub cmdSave_Click()
    Dim myPageWindow As PageWindowEx

    Set myPageWindow = ActiveWeb.ActiveWebWindow.ActivePageWindow
    myPageWindow.Save
End Sub
Private Sub cmdCancel_Click()
    'Hide the form.
    frmLaunchEvents.Hide
    Exit Sub
End Sub
Private Sub eFPApplication_OnAfterPageSave(ByVal pPage As _
        PageWindow, Success As Boolean)
    If Success = True Then
        MsgBox "The following page was saved: " & pPage.File.Name
    Else
         MsgBox "There was a problem with saving your page: " & _
        pPage.File.Name
    End If
End Sub