Private Sub textbox4_Change()
If TextBox4.TextLength = 2 Or TextBox4.TextLength = 5 Then TextBox4.Text = TextBox4 + ":" 'pour les secondes Or TextBox4.TextLength = 5
End Sub
Private Sub TextBox4_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Dim VT As Integer
TextBox4.MaxLength = 8
Select Case KeyAscii
Case 48 To 57
If Len(Controls("TextBox4" & Tex)) = 0 And Not ChrW(KeyAscii) Like "[0,1,2]" Then KeyAscii = 0: MsgBox "1er chiffre est 0 ou 1 ou 2 " ' 1er chiffre jour
If Len(Controls("TextBox4" & Tex)) = 3 And Not ChrW(KeyAscii) Like "[0,1,2,3,4,5]" Then KeyAscii = 0: MsgBox "le chiffre est 0 ou 1 ou 2 ou 3 ou 4 ou 5 "
1 If Len(Controls("TextBox4" & Tex)) = 6 And Not ChrW(KeyAscii) Like "[0,1,2,3,4,5]" Then KeyAscii = 0: MsgBox "le chiffre est 0 ou 1 ou 2 ou 3 ou 4 ou 5 " '1er chiffre année
Case Else
KeyAscii = 0
MsgBox "CARACTERE NON AUTORISE"
End Select
End Sub
Private Sub TextBox4_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox4 <> "" Then
If Len(Me.TextBox4.Value) < 8 Then
'TextBox4 = ""
SendKeys "+{TAB}", False
TextBox4.SetFocus
MsgBox "Format horaire erroné, pour rappel hh:mm "
SendKeys "+{TAB}", True
End If
End If
End Sub