send focus to a textbox

T

TimT

Hello all,
When my file opens I want it set the focus on a textbox that holds a user
agreement in it with scrollbars.
I want it to set the focus on the text box so that it starts at the
beginning of the verbiage that's written in it.
Any help?
 
P

Peter T

Also, to place the cursor at the beginning of the 'verbiage'

TextBox1.SetFocus
TextBox1.SelStart = 0

Regards,
Peter T
 
T

TimT

Thanks for your response.
You guys definitely understand what I trying to accomplish here.
I'm getting a Run-time error '424' Object required

I wasn't clear about all the facts I'm afraid.

The txtUserAgreement is embeded on sheet1 not a userform and sheet1 is
selected at the workbook open event.
 
T

TimT

Okay...
It never fails.
I figured it out right after I replied.
I placed the code on the GotFocus of the txtUserAgreement.
Thanks guys!
 
P

Peter T

Sorry Tim, for a (Controls toolbox) Textbox on a worksheet you probably want
this pair

TextBox1.Activate
TextBox1.SelStart = 0

(substitute TextBox1 with your txtUserAgreement )

Code might go for example in the Worksheet activate event.

Regards,
Peter T
 

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