Share via


BeforeClose event

Occurs before the map closes. If the map has been changed, this event occurs before the user is asked to save changes.

Applies to

Objects: Application

Syntax

object . BeforeClose( Cancel )

Parameters

Part

Description

object

An expression that evaluates to an Application object.

Cancel

Boolean. False when the event occurs. If the event procedure sets this argument to True, the map doesn't close when the procedure is finished.

Remarks

  • Do not make this event infinitely recursive by calling itself or causing itself to be called.

Example

  Dim WithEvents objApp As MapPoint.Application

  Private Sub Command1_Click()
    'Refresh the map using NewMap
    objApp.NewMap
  End Sub

  Private Sub Form_Load()
    'Set up the application
    Set objApp = CreateObject("mappoint.application")
    objApp.Visible = True
    objApp.UserControl = True
  End Sub

  Private Sub objApp_BeforeClose(Cancel As Boolean)
    MsgBox "BeforeClose event fired"
  End Sub