Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How do you get the text in a textbox to be highlighted when the userform
activates? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Normally, you would put this code...
TextBox1.SelStart = 0 TextBox1.SelLength = Len(TextBox1.Text) TextBox1.SetFocus in the UserForm's Activate event. HOWEVER, there seems to be a problem if TextBox1 was the last control to have had focus when the UserForm was deactivated... for some reason, the text will not be highlighted under these conditions when you return to the UserForm. So, either make sure some other control has focus when the UserForm is deactivated or simply use this code in place of the above code... SendKeys "{TAB}+{TAB}" TextBox1.SelStart = 0 TextBox1.SelLength = Len(TextBox1.Text) Of course, this requires at least one other control capable of taking focus to be on the UserForm. Rick "jnf40" wrote in message ... How do you get the text in a textbox to be highlighted when the userform activates? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jan 2, 2:58*pm, jnf40 wrote:
How do you get the text in a textbox to be highlighted when the userform activates? Set the index number of that text box to zero so it is the first active object when the userform loads. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Rick, Don
Thank you both for your replies, works great. "Don" wrote: On Jan 2, 2:58 pm, jnf40 wrote: How do you get the text in a textbox to be highlighted when the userform activates? Set the index number of that text box to zero so it is the first active object when the userform loads. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Highlight the contain of textbox and radio button | Excel Programming | |||
Highlight certail text in a userform Text box | Excel Programming | |||
highlight text in userform textbox | Excel Programming | |||
Highlight all Text in a Textbox when the textbox is selected | Excel Programming | |||
check variable(text) with cell (text), textbox | Excel Programming |