Default property (Microsoft Forms)

Designates the default command button on a form.

Syntax

object.Default [= Boolean ]

The Default property syntax has these parts:

Part Description
object Required. A valid object.
Boolean Optional. Whether the command button is the default.

Settings

The settings for Boolean are:

Value Description
True The CommandButton is the default button.
False The CommandButton is not the default button (default).

Remarks

A CommandButton or an object that acts like a command button can be designated as the default command button. Only one object on a form can be the default command button. Setting the Default property to True for one object automatically sets it to False for all other objects on the form.

To choose the default command button on an active form, the user can click the button, or press ENTER when no other CommandButton has the focus. Pressing ENTER when no other CommandButton has the focus also initiates the KeyUp event for the default command button.

Default is provided for OLE container controls (Windows only) that specifically act like CommandButton controls.

Tip

You should consider making the Cancel button the default button for forms that support operations that can't be undone (such as delete). To do this, set both Default and the Cancel property to True.

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.