View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default VB Form field highlighting

Private Sub CommandButton1_Click()
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1)
TextBox1.SetFocus
End Sub

While I have put this in a commandbutton, it isn't clear how you would need
to trigger it. Surely something happens after the barcode is scanned in or
does someone just look at the userform? (how are other controls populated?)

--
Regards,
Tom Ogilvy

"wonky muffin" <wonky wrote in message
...
I am using a VB Form to allow a barcode to be scanned into a text box and
then various other actions take place. This is the only input field on the
screen. All others are display only. The problem I have is that after the
barcode is scanned, the cursor remains at the end of the scanned number. I
would like the whole field to be selected (highlighted) so that I can then
scan another number to overwrite the previous one. One possibility is to

make
the cursor tab to another field and then back again but this is outside of

my
ability.
I'm using VBA that comes with excel 2003. (6.3)I think