Select Text in Text Box

S

Sam

Hello,

I have a user form that when it opens, I want the default text in it to be selected. I can't figure out how to do this. I've tried setting the relevant properties and used the Setfocus method, but I can't get it to work. Is this possible?

Any help would be appreciated!

Sam
 
B

Bob Phillips

Sam,

You need SelStart as well

With TextBox1
.Text = "This is a test"
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Thomas said:
Text1.SelLength = Len(Text1)
be selected. I can't figure out how to do this. I've tried setting the
relevant properties and used the Setfocus method, but I can't get it to
work. Is this possible?
 

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

Top