EnterFieldBehavior 属性EnterFieldBehavior property

指定在进入**TextBox** 或**ComboBox** 时的选择行为。Specifies the selection behavior when entering a TextBox or ComboBox.


对象EnterFieldBehavior[= fmEnterFieldBehavior ]object.EnterFieldBehavior [= fmEnterFieldBehavior ]

EnterFieldBehavior 属性语法包含以下部分:The EnterFieldBehavior property syntax has these parts:

PartPart 说明Description
objectobject 必需。Required. 一个有效对象。A valid object.
fmEnterFieldBehaviorfmEnterFieldBehavior 可选。Optional. 所需的选择行为。The desired selection behavior.


fmEnterFieldBehavior 的设置为:The settings for fmEnterFieldBehavior are:

常量Constant Value 说明Description
fmEnterFieldBehaviorSelectAllfmEnterFieldBehaviorSelectAll 00 在进入控件时选择编辑区域的所有内容(默认值)。Selects the entire contents of the edit region when entering the control (default).
fmEnterFieldBehaviorRecallSelectionfmEnterFieldBehaviorRecallSelection 11 将选择保持不变。Leaves the selection unchanged. 直观上说,这将使用上次激活控件时生效的选择。Visually, this uses the selection that was in effect the last time the control was active.


EnterFieldBehavior 属性将控制当用户选择控件时而不是在控件因 SetFocus 方法收到焦点时选择文本的方式。The EnterFieldBehavior property controls the way text is selected when the user tabs to the control, not when the control receives focus as a result of the SetFocus method.

SetFocus之后, 不会选择控件的内容, 并且插入点将显示在控件的编辑区域中的最后一个字符之后。Following SetFocus, the contents of the control are not selected, and the insertion point appears after the last character in the control's edit region.

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.