Reputation: 157
How can I make a text box in a UserForm activate when the UserForm activates, so that the user can start typing without having to click in the text box?
Upvotes: 0
Views: 19230
Reputation: 7993
What you are looking for is the TabIndex Property.
Every object on your userform has one, it is the order to which object on the userform are selected when you press the tab button. The object with 0 TabIndex
will be the active object when a form is loaded also:
So with the textbox
selected go to the properties pane and look for Tabindex
set this to 0 and your textbox
will be selected on open.
You can also set other textboxes
index to 1,2,3 and on, so that if the form is being filled out you can simply press tab to go from one text box to another.
Upvotes: 5
Reputation: 14169
Use .SetFocus
. If your textbox's name is TextBox1
, the following works:
Private Sub UserForm_Initialize()
TextBox1.SetFocus
End Sub
Let us know if this helps.
Upvotes: 1