evo sad naidjoh na neki svoj stari kod, mozda ti ovako nesto treba:
Code:
Public Function ReplaceWord(ByVal s As String, needle As String, _
replaceWith As String, _
Optional delimiters As String = _
".,<>/?\|][]{};'"":~`!@#$%^&*()_+-= " & vbTab, _
Optional compare As VbCompareMethod = vbTextCompare) _
As String
Dim pos As Long
Dim l As Boolean
Dim r As Boolean
pos = -Len(replaceWith)
Do
pos = InStr(pos + Len(replaceWith) + 1, s, needle, compare)
If pos > 0 Then
l = True
r = True
If pos > 1 Then l = InStr(1, delimiters, Mid$(s, pos - 1, 1)) > 0
If pos < Len(s) - Len(needle) Then r = InStr(1, delimiters, Mid$(s, pos + Len(needle), 1)) > 0
If l And r Then
s = Mid$(s, 1, pos - 1) & replaceWith & Mid$(s, pos + Len(needle))
End If
End If
Loop Until pos < 1
ReplaceWord = s
End Function