Salut Didier et le forum,
Un petit code qui permet de déterminer si numérique et longueur max 13 (pour le même textbox : [g]TxtBSecu[/g] tu l'adaptera à ton projet)
Dim ERREUR As Boolean
'Test lors de la saisie
Private Sub TxtBSecu_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If Not IsNumeric(Chr(KeyAscii)) Then
MsgBox Chr(KeyAscii) & " n'est pas un nombre"
ERREUR = True
End If
If Len(TxtBSecu) > 12 Then
MsgBox "13 caractères maxi"
ERREUR = True
End If
End Sub
'Récupération sans le dernier caractère saisi
Private Sub TxtBSecu_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If ERREUR Then
ERREUR = False
TxtBSecu = Left(TxtBSecu, Len(TxtBSecu) - 1)
End If
End Sub
Je ne t'envoi pas le fichier because off pb sur forum mais si tu veux l'exemple dans ta BAL fais le savoir
@+
Valérie