Highlighting text in a textbox

  • Thread starter Thread starter Daniel Bonallack
  • Start date Start date
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
 
Private Sub UserForm_Initialize()
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1.Text)
End Sub

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

-Brad

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top