Option Explicit
Dim a$
Private Sub TextBox1_Change()
Dim t$, tb As Object, i%, c$
Set tb = Me.TextBox1: t = tb: tb = UCase(t)
If Len(t) >= 12 Then
tb = a: Exit Sub
ElseIf Len(t) < 4 Then
For i = 1 To IIf(Len(t) > 3, 3, Len(t))
c = Asc(Mid(t, i, 1))
If c < 65 Or (c > 90 And c < 97) Or c > 122 Then tb = a: Exit Sub
Next i
Else
For i = 4 To Len(t)
c = Asc(Mid(t, i, 1))
If c < 48 Or c > 57 Then tb = a: Exit Sub
Next i
End If
a = t
End Sub