CancelButton Property

Property that allows you to get or set which push button is activated when the user pressed the Esc key. The default value for this property is "Cancel."

object.CancelButton = caption_of_button
existing_value
= object.CancelButton

Arguments

object

Required.  A variable containing a dialog object created by calling CreateObject or new ActiveXControl.

caption_of_button

Required. Caption of the button that should be activated when the user presses the Esc key.

existing_value

A variable to receive the caption of the button that will be activated when the user presses the Esc key.

Remarks
If your dialog box does not include a button with the caption "Cancel," you should set the CancelButton property to the caption of some other button on your dialog box. See also DefaultButton.

Example

Sub main
  ' Create the dialog box
  Set Dialog = CreateObject("TPFSoftware.ScriptDialog")


 ' Add a row of buttons  Dialog.AddButtons "button", Array("Continue", "Quit")
 ' Ensure that pressing Esc will activate Quit  Dialog.CancelButton = "Quit"
 ' Display the dialog box
  Set Result = Dialog.Execute
 ' Determine whether the user pressed Esc or clicked Quit  If Result.ValueOf("button") = "Quit"
    ' Take some action...  End If
End Sub