Highlight text in Textbox
Normally, you would put this code...
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1.Text)
TextBox1.SetFocus
in the UserForm's Activate event. HOWEVER, there seems to be a problem if
TextBox1 was the last control to have had focus when the UserForm was
deactivated... for some reason, the text will not be highlighted under these
conditions when you return to the UserForm. So, either make sure some other
control has focus when the UserForm is deactivated or simply use this code
in place of the above code...
SendKeys "{TAB}+{TAB}"
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1.Text)
Of course, this requires at least one other control capable of taking focus
to be on the UserForm.
Rick
"jnf40" wrote in message
...
How do you get the text in a textbox to be highlighted when the userform
activates?
|