send focus to a textbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
Also, to place the cursor at the beginning of the 'verbiage'

TextBox1.SetFocus
TextBox1.SelStart = 0

Regards,
Peter T
 
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.
 
Okay...
It never fails.
I figured it out right after I replied.
I placed the code on the GotFocus of the txtUserAgreement.
Thanks guys!
 
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
 
Back
Top