OnBeforePageWindowViewChange Event

Microsoft FrontPage Visual Basic

OnBeforePageWindowViewChange Event

Occurs before the current Page window view is changed.

Private Sub application__OnBeforePageWindowViewChange(ByVal pPage As PageWindowEx, ByVal TargetView As FpPageViewMode, Cancel As Boolean)

application     An object of type Application declared using the WithEvents keyword in a class module.

pPage       The PageWindowEx object in which the view has changed.

TargetView The specified target window type.

Cancel A Boolean that determines if the event will be cancelled. If False, the event will not be cancelled. If True, the event will be cancelled.

Remarks

This event can be cancelled.

Example

The following example prompts the user before the current view is changed. The Cancel argument is modified based on the user's response.

Private Sub objApp_OnBeforePageWindowViewChange(ByVal pPage As PageWindowEx,  _
        ByVal TargetView As FpPageViewMode, Cancel As Boolean)
'Prompts the user before changing the view type

    Dim strAns As String
    'Prompt user to change view
    strAns = MsgBox("Are you sure you want to change the current view?", _
                    vbYesNo)
    If strAns = vbYes Then
        'Don't cancel event
        Cancel = False
    Else
        'Cancel event
        Cancel = True
End Sub