Close Method Example

This example closes the fourth open page and calls the error handler to display a message if error 4198 results—that means the user clicked the Cancel button.

On Error GoTo errorHandler
PageWindows.Close(3,True)

errorHandler:
If Err=4198 Then MsgBox "PageWindow was not closed."