Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim nc As Integer, s As String
s = Trim(TextBox1): nc = Len(s)
If nc = 0 Then Exit Sub
If (nc <> 8 And nc <> 6) Or Not IsNumeric(s) Then
MsgBox "Vous devez entrer 8 ou 6 chiffres sans espaces", , "Agrément"
TextBox1 = ""
Else
TextBox1 = Format(s, IIf(nc = 8, "00/0/0/0000", _
"00 0 0 0000"))
End If
End Sub