ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB Form field highlighting (https://www.excelbanter.com/excel-programming/314490-vbulletin-form-field-highlighting.html)

wonky muffin

VB Form field highlighting
 
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

Tom Ogilvy

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





All times are GMT +1. The time now is 02:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com