Share via


BeforeSave event

Occurs immediately before the map is saved.

Applies to

Objects: Application

Syntax

object.BeforeSave(SaveAsUi, Cancel)

Parameters

Part

Description

object

An expression that evaluates to an Application object.

SaveAsUi

ByVal Boolean. True if the Save As dialog box will be displayed.

Cancel

Boolean. False when the event occurs. If the event procedure sets this argument to True, the map is not saved 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 Form_Load()
    'Set up the application
    Set objApp = CreateObject("mappoint.application")
    objApp.Visible = True
    objApp.UserControl = True
  End Sub

  Private Sub Command1_Click()
    'Save the map when button is clicked
    objApp.ActiveMap.SaveAs "SavedFile.ptm"
  End Sub

  Private Sub objApp_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    MsgBox "BeforeSave event fired."
  End Sub