AW: Zeit in TextBox
04.11.2012 20:09:21
Hajo_Zi
Hallo Frank,
setze maxLength auf 5
Option Explicit
Private Sub TextBox11_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
' erstellt von HajoZiplies@web.de Stand 06.06.04
Select Case KeyAscii
Case Asc("0") To Asc("9")
Case Asc(":")
If Len(TextBox11) = 0 Then
KeyAscii = 0
Else
If Len(TextBox11) - Len(Application.Substitute(TextBox11, ":", "")) = 2 Then
KeyAscii = 0
ElseIf Len(TextBox11) > 1 Then
If Mid(TextBox11, Len(TextBox11), 1) = ":" Then KeyAscii = 0
Else
KeyAscii = Asc(":")
End If
End If
Case Else
KeyAscii = 0
End Select
End Sub
Private Sub TextBox11_Change()
If Len(TextBox11) = 2 Then
If InStr(TextBox11, ":") = 0 Then TextBox11 = TextBox11 & ":"
End If
End Sub