@ReplaceSubString en LS
Une version parmi tant d'autres
Function replaceSubString(tmpString As String, oldString As String, newString As Variant, onServer As Integer) As Integer
Dim position As Integer
Dim lenOldString As Integer
On Error Goto handleError
'// Pour éviter un plantage si l'origine est NULL
If tmpString = "" Then
replaceSubString = True
Exit Function
End If
'// Recherche de la première occurence de la chaine à remplacer
lenOldString = Len(oldString)
position = Instr(tmpString, oldString)
'// et tant que la chaine n'est pas entièrment remplacée
Do While position > 0 And oldString <> ""
'// recontruit la chaine avec sa nouvelle valeur de sous-chaine
tmpString = Left(tmpString, position - 1) & newString & Mid(tmpString, position + lenOldString)
position = Instr(position + Len(newString), tmpString, oldString)
Loop
'// Remplacement effectué
replaceSubString = True
Exit Function
handleError:
Msgbox "Erreur n° " & Err & " : " & Error$ & " ligne " & Erl,16,"replaceSubstring"
fin:
End Function