How to limit munber of characters in TextBox?

P

Peter KNAP

Hi,
could somebody help me with limiting number of characters to be possible
type into the userform text box please?
I would like to limit max two characters to be typed and coursor should go
to nwext text box.
thanks,
Peter
 
D

Doug Robbins - Word MVP

Private Sub TextBox1_Change()
If Len(TextBox1.Text) > 1 Then
TextBox2.SetFocus
End If
End Sub


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
F

fumei via OfficeKB.com

1. set the textbox MaxLength = 2
2. set the textbox AutoTab = True

type in "23" and focus will automatically shift to the next control in the
Tab Order.
Private Sub TextBox1_Change()
If Len(TextBox1.Text) > 1 Then
TextBox2.SetFocus
End If
End Sub
Hi,
could somebody help me with limiting number of characters to be possible
[quoted text clipped - 3 lines]
thanks,
Peter
 
P

Peter KNAP

Thanks Doug.
exactly what I need.
peter


„Doug Robbins - Word MVP" napísal (napísala):
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top