ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   send focus to a textbox (https://www.excelbanter.com/excel-programming/372575-send-focus-textbox.html)

TimT

send focus to a textbox
 
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?


Halim

send focus to a textbox
 
Hi,
You can use this :

Private sub UserForm_Activate()\
Textbox1.setfocus
End Sub
--

Regards,

Halim


"TimT" wrote:

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?


Peter T

send focus to a textbox
 
Also, to place the cursor at the beginning of the 'verbiage'

TextBox1.SetFocus
TextBox1.SelStart = 0

Regards,
Peter T


"Halim" wrote in message
...
Hi,
You can use this :

Private sub UserForm_Activate()\
Textbox1.setfocus
End Sub
--

Regards,

Halim


"TimT" wrote:

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?




TimT

send focus to a textbox
 
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.



"Peter T" wrote:

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

TextBox1.SetFocus
TextBox1.SelStart = 0

Regards,
Peter T


"Halim" wrote in message
...
Hi,
You can use this :

Private sub UserForm_Activate()\
Textbox1.setfocus
End Sub
--

Regards,

Halim


"TimT" wrote:

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?





TimT

send focus to a textbox
 
Okay...
It never fails.
I figured it out right after I replied.
I placed the code on the GotFocus of the txtUserAgreement.
Thanks guys!

"TimT" wrote:

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.



"Peter T" wrote:

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

TextBox1.SetFocus
TextBox1.SelStart = 0

Regards,
Peter T


"Halim" wrote in message
...
Hi,
You can use this :

Private sub UserForm_Activate()\
Textbox1.setfocus
End Sub
--

Regards,

Halim


"TimT" wrote:

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?





Peter T

send focus to a textbox
 
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


"TimT" wrote in message
...
Okay...
It never fails.
I figured it out right after I replied.
I placed the code on the GotFocus of the txtUserAgreement.
Thanks guys!

"TimT" wrote:

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.



"Peter T" wrote:

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

TextBox1.SetFocus
TextBox1.SelStart = 0

Regards,
Peter T


"Halim" wrote in message
...
Hi,
You can use this :

Private sub UserForm_Activate()\
Textbox1.setfocus
End Sub
--

Regards,

Halim


"TimT" wrote:

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?








All times are GMT +1. The time now is 09:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com