CommandButton.TakeFocusOnClick Property (Outlook Forms Script)

Returns or sets a Boolean that specifies whether a control takes the focus when clicked. Read/write.

Syntax

expression.TakeFocusOnClick

expression A variable that represents a CommandButton object.

Remarks

True if the button takes the focus when clicked (default). False if the button does not take the focus when clicked.

The TakeFocusOnClick property defines only what happens when the user clicks a control. If the user tabs to the control, the control takes the focus regardless of the value of TakeFocusOnClick.

Use this property to complete actions that affect a control without requiring that control to give up focus. For example, assume your form includes a TextBox and a CommandButton that checks for correct spelling of text. You would like to be able to select text in the TextBox, then click the CommandButton and run the spelling checker without taking focus away from the TextBox. You can do this by setting the TakeFocusOnClick property of the CommandButton to False.

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.