EnterKeyBehavior property
Defines the effect of pressing ENTER in a TextBox.
Syntax
object.EnterKeyBehavior [= Boolean ]
The EnterKeyBehavior property syntax has these parts:
Part | Description |
---|---|
object | Required. A valid object. |
Boolean | Optional. Specifies the effect of pressing ENTER. |
Settings
The settings for Boolean are:
Value | Description |
---|---|
True | Pressing ENTER creates a new line. |
False | Pressing ENTER moves the focus to the next object in the tab order (default). |
Remarks
The EnterKeyBehavior and MultiLine properties are closely related. The values described above only apply if MultiLine is True. If MultiLine is False, pressing ENTER always moves the focus to the next control in the tab order regardless of the value of EnterKeyBehavior.
The effect of pressing CTRL+ENTER also depends on the value of MultiLine. If MultiLine is True, pressing CTRL+ENTER creates a new line regardless of the value of EnterKeyBehavior. If MultiLine is False, pressing CTRL+ENTER has no effect.
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.