View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_3_] Bob Phillips[_3_] is offline
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