Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Hal Hal is offline
external usenet poster
 
Posts: 36
Default Select (highlight) Text in txtBox at Initialization

When tabing through the text boxes on my form all data within a text box is
selcted because the EnterFieldBehavior is set to select all. On form
initilization the first text box in the tab order has the cursor at the end
of the field. I want to have all text in this box selected at form
initalization.

You advise is appreciated to fill in the line of code below, txtBoxName,


Private Sub UserForm_Activate()
txtBoxName (select all the text in the box)
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Select (highlight) Text in txtBox at Initialization

Maybe

Private Sub UserForm_Activate()
With txtBoxName

.SelLength = Len(.Text)
.SelStart = 0
.SetFocus
End With
End Sub

--
__________________________________
HTH

Bob

"Hal" wrote in message
...
When tabing through the text boxes on my form all data within a text box
is
selcted because the EnterFieldBehavior is set to select all. On form
initilization the first text box in the tab order has the cursor at the
end
of the field. I want to have all text in this box selected at form
initalization.

You advise is appreciated to fill in the line of code below, txtBoxName,


Private Sub UserForm_Activate()
txtBoxName (select all the text in the box)
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Select (highlight) Text in txtBox at Initialization

Hi,

Try this

Private Sub UserForm_Initialize()
With Me.TextBox1
.Value = "test"
.SelStart = 0
.SelLength = Len(.Value)
End With
End Sub

Mike

"Hal" wrote:

When tabing through the text boxes on my form all data within a text box is
selcted because the EnterFieldBehavior is set to select all. On form
initilization the first text box in the tab order has the cursor at the end
of the field. I want to have all text in this box selected at form
initalization.

You advise is appreciated to fill in the line of code below, txtBoxName,


Private Sub UserForm_Activate()
txtBoxName (select all the text in the box)
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
Hal Hal is offline
external usenet poster
 
Posts: 36
Default Select (highlight) Text in txtBox at Initialization

Thanks Mike, Worked as needed.

"Mike H" wrote:

Hi,

Try this

Private Sub UserForm_Initialize()
With Me.TextBox1
.Value = "test"
.SelStart = 0
.SelLength = Len(.Value)
End With
End Sub

Mike

"Hal" wrote:

When tabing through the text boxes on my form all data within a text box is
selcted because the EnterFieldBehavior is set to select all. On form
initilization the first text box in the tab order has the cursor at the end
of the field. I want to have all text in this box selected at form
initalization.

You advise is appreciated to fill in the line of code below, txtBoxName,


Private Sub UserForm_Activate()
txtBoxName (select all the text in the box)
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Select (highlight) Text in txtBox at Initialization

Glad I could help and thanks for the feedback

"Hal" wrote:

Thanks Mike, Worked as needed.

"Mike H" wrote:

Hi,

Try this

Private Sub UserForm_Initialize()
With Me.TextBox1
.Value = "test"
.SelStart = 0
.SelLength = Len(.Value)
End With
End Sub

Mike

"Hal" wrote:

When tabing through the text boxes on my form all data within a text box is
selcted because the EnterFieldBehavior is set to select all. On form
initilization the first text box in the tab order has the cursor at the end
of the field. I want to have all text in this box selected at form
initalization.

You advise is appreciated to fill in the line of code below, txtBoxName,


Private Sub UserForm_Activate()
txtBoxName (select all the text in the box)
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to select / highlight entire row. Ross Excel Programming 5 August 28th 09 07:20 PM
highlight select data Lindsay Excel Discussion (Misc queries) 1 June 4th 09 06:36 PM
Highlight (ie Select characters in a textbox) Steven Excel Programming 1 March 8th 09 03:29 AM
why do 2 cells highlight when I only select 1? Montgomeryc Excel Discussion (Misc queries) 2 January 29th 09 06:45 PM
Highlight/Select text in User Form? Alan Smith Excel Discussion (Misc queries) 2 September 13th 07 09:02 PM


All times are GMT +1. The time now is 07:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"