|
-
Feb 27th, 2014, 08:35 AM
#1
Thread Starter
New Member
[RESOLVED] Select contents of textbox [VBA] both msOf07 and msOf10
I have a userform where I have different textboxes. What I want is for the all the contents to be selected upon focus on the box. I am trying to get this to work through Excel VBA.
Googling gave me some inspiration to use selstart and sellength.
The name of the box is txtStartHour, and the name of the sub is "txtStartHour_enter", I figure that "enter" is the VBA eqvivalent of "GotFocus" in VB6.
I have tried
With Me.txtStartHour
.SetFocus
.SelStart = 0
.SelLength = Len(Me.txtStartHour.Text)
End With
and
txtStartHour.setFocus
txtStartHour.SelStart=0
txtStartHour.SelLength=len(txtStartHour.text)
The sub is getting called, I am assured of this as when I go step by step the code get highlighted.
Thanks!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|