Private Sub Form_Load()Text1.MaxLength = 6End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 Then KeyAscii = 0End Sub