Public Function sup_car(txt As String) As String
' Tableau : liste des caractères à traiter
Dim caractere(1)
caractere(0) = chr(32) ' espace
caractere(1) = chr(10) ' saut de ligne
For x = LBound(caractere) To UBound(caractere) Step 1
' Position des caractères à supprimer
ReDim car(Len(txt)) As String
For a = 1 To Len(txt) Step 1
If Right(Left(txt, a), 1) = caractere(x) And Right(Left(txt, a - 1), 1) = caractere(x) Then car(a) = a
Next a
' Suppression des caractères aux positions déterminées
For b = Len(txt) To 1 Step -1
If car(b) <> "" Then
txt = Left(txt, b - 1) & Right(txt, Len(txt) - b)
End If
Next b
' Suppression des espaces de début et fin de chaîne
If Left(txt, 1) = caractere(x) Then txt = Right(txt, Len(txt) - 1)
If Right(txt, 1) = caractere(x) Then txt = Left(txt, Len(txt) - 1)
Next x
End Function