Option Explicit
Private Sub UserForm_Initialize()
TextBox1.MaxLength = 10
End Sub
Private Sub TextBox1_Change()
If Len(TextBox1) = 2 Or Len(TextBox1) = 5 Then TextBox1 = TextBox1 & "/"
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If InStr("0123456789", Chr(KeyAscii)) = 0 Then KeyAscii = 0
End Sub
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1 = "" Then Exit Sub
If Not IsDate(TextBox1) Then MsgBox "saisie erronée": TextBox1 = "":Cancel = True
End Sub