Private Sub TxtTelephone_Change()
Me.TxtTelephone.MaxLength = 10 'Défini la longueur Max de chiffre
End Sub
Private Sub TxtTelephone_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim Tel As Double
Tel = CDbl(Me.TxtTelephone.Text)
Me.TxtTelephone.Text = Format(Tel, IIf(Tel >= 8000000000#, "000 0", "00 00 ") & "00 00 00")
End Sub
Private Sub TxtTelephone_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'Interdire les lettres dans le TextBox
If Not (KeyAscii >= 48 And KeyAscii <= 57) Then
KeyAscii = 0
'Si erreur alors message
MsgBox "Uniquement des chiffres, SVP !"
End If
End Sub