Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Luiz Cláudio
Hi Lou,
you cannot put it all on one line, but if you want it's possible to create a VBA function to replace many characters. Consider this sample:
Public Function TiraAcento(sTexto As String) As String 'Retorna o texto sem acentuação Dim Carac_esp, C_especial, C_subst As String Dim F_tam As Integer, F_pos As Integer Dim conta_letra As Integer, conta_pos As Integer Dim Fonte As String
For conta_letra = 1 To F_tam Carac_esp = Mid$(Fonte, conta_letra, 1) F_pos = InStr(1, C_especial, Carac_esp, vbBinaryCompare) If F_pos > 0 Then Mid(Fonte, conta_letra, 1) = Mid(C_subst, F_pos, 1) End If Next conta_letra TiraAcento = Fonte End Function
In the constant C_Especial you put the character you want to be replaced, and in the conts C_subst you put the new character, in the same position. As you have some zero lenght string, you can use a single space (" ") in C_subst and in the end Trim the result.
Personally, I would prefer to use some lines of Replace() function, but this one above can be very helpful also.
Luiz Cláudio C. V. Rocha São Paulo - Brasil
"lou" escreveu na mensagem news:4049d43d$0$13868$
bonjour
sur clic j'execute cette action
Private Sub Commande70_Click() ' remplacer le point par rien: Libelle = Replace(Libelle, ".", "") ' remplacer le & par rien: Libelle = Replace(Libelle, "&", "") ' remplacer le , par rien: Libelle = Replace(Libelle, ",", "") ' remplacer le ' par rien: Libelle = Replace(Libelle, "'", "") ' remplacer le Les par rien: Libelle = Replace(Libelle, "Les", "") ' remplacer le ? par rien: Libelle = Replace(Libelle, "?", "") ' remplacer le : par rien: Libelle = Replace(Libelle, ":", "") ' remplacer le / par rien: Libelle = Replace(Libelle, "/", "") ' remplacer le * par rien: Libelle = Replace(Libelle, "*", "") ''''''''''''enleve espaces du Libelle'''''''''''' Libelle = Replace([Libelle], " ", "")
you cannot put it all on one line, but if you want it's possible to create a
VBA function to replace many characters. Consider this sample:
Public Function TiraAcento(sTexto As String) As String
'Retorna o texto sem acentuação
Dim Carac_esp, C_especial, C_subst As String
Dim F_tam As Integer, F_pos As Integer
Dim conta_letra As Integer, conta_pos As Integer
Dim Fonte As String
For conta_letra = 1 To F_tam
Carac_esp = Mid$(Fonte, conta_letra, 1)
F_pos = InStr(1, C_especial, Carac_esp, vbBinaryCompare)
If F_pos > 0 Then
Mid(Fonte, conta_letra, 1) = Mid(C_subst, F_pos, 1)
End If
Next conta_letra
TiraAcento = Fonte
End Function
In the constant C_Especial you put the character you want to be replaced,
and in the conts C_subst you put the new character, in the same position. As
you have some zero lenght string, you can use a single space (" ") in
C_subst and in the end Trim the result.
Personally, I would prefer to use some lines of Replace() function, but this
one above can be very helpful also.
Luiz Cláudio C. V. Rocha
São Paulo - Brasil
"lou" <colluluigi@skynet.be> escreveu na mensagem
news:4049d43d$0$13868$ba620e4c@news.skynet.be...
bonjour
sur clic j'execute cette action
Private Sub Commande70_Click()
' remplacer le point par rien:
Libelle = Replace(Libelle, ".", "")
' remplacer le & par rien:
Libelle = Replace(Libelle, "&", "")
' remplacer le , par rien:
Libelle = Replace(Libelle, ",", "")
' remplacer le ' par rien:
Libelle = Replace(Libelle, "'", "")
' remplacer le Les par rien:
Libelle = Replace(Libelle, "Les", "")
' remplacer le ? par rien:
Libelle = Replace(Libelle, "?", "")
' remplacer le : par rien:
Libelle = Replace(Libelle, ":", "")
' remplacer le / par rien:
Libelle = Replace(Libelle, "/", "")
' remplacer le * par rien:
Libelle = Replace(Libelle, "*", "")
''''''''''''enleve espaces du Libelle''''''''''''
Libelle = Replace([Libelle], " ", "")
you cannot put it all on one line, but if you want it's possible to create a VBA function to replace many characters. Consider this sample:
Public Function TiraAcento(sTexto As String) As String 'Retorna o texto sem acentuação Dim Carac_esp, C_especial, C_subst As String Dim F_tam As Integer, F_pos As Integer Dim conta_letra As Integer, conta_pos As Integer Dim Fonte As String
For conta_letra = 1 To F_tam Carac_esp = Mid$(Fonte, conta_letra, 1) F_pos = InStr(1, C_especial, Carac_esp, vbBinaryCompare) If F_pos > 0 Then Mid(Fonte, conta_letra, 1) = Mid(C_subst, F_pos, 1) End If Next conta_letra TiraAcento = Fonte End Function
In the constant C_Especial you put the character you want to be replaced, and in the conts C_subst you put the new character, in the same position. As you have some zero lenght string, you can use a single space (" ") in C_subst and in the end Trim the result.
Personally, I would prefer to use some lines of Replace() function, but this one above can be very helpful also.
Luiz Cláudio C. V. Rocha São Paulo - Brasil
"lou" escreveu na mensagem news:4049d43d$0$13868$
bonjour
sur clic j'execute cette action
Private Sub Commande70_Click() ' remplacer le point par rien: Libelle = Replace(Libelle, ".", "") ' remplacer le & par rien: Libelle = Replace(Libelle, "&", "") ' remplacer le , par rien: Libelle = Replace(Libelle, ",", "") ' remplacer le ' par rien: Libelle = Replace(Libelle, "'", "") ' remplacer le Les par rien: Libelle = Replace(Libelle, "Les", "") ' remplacer le ? par rien: Libelle = Replace(Libelle, "?", "") ' remplacer le : par rien: Libelle = Replace(Libelle, ":", "") ' remplacer le / par rien: Libelle = Replace(Libelle, "/", "") ' remplacer le * par rien: Libelle = Replace(Libelle, "*", "") ''''''''''''enleve espaces du Libelle'''''''''''' Libelle = Replace([Libelle], " ", "")