Highlighting text in a textbox

D

Daniel Bonallack

Could someone please tell me how to highlight the text in
a textbox on a form?

My textbox has just the number 1 in it, and when the form
is initialized, I'd like the focus on that textbox, with
the number 1 highlighted.

Thank you very much

Daniel
 
B

Brad Vontur

Private Sub UserForm_Initialize()
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1.Text)
End Sub

-Brad
 
D

Daniel Bonallack

Thank you
-----Original Message-----
Private Sub UserForm_Initialize()
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1.Text)
End Sub

-Brad

.
 
Top