Public Function ReplaceSubstring(ByVal txt As String, ByVal from_str As String, ByVal to_str As String) As String
Dim pos As Integer
Dim new_text As String
Dim from_len As Integer
from_len = Len(from_str)
Do While Len(txt) > 0
pos = InStr(txt, from_str)
If pos = 0 Then
new_text = new_text & txt
txt = ""
Else
new_text = new_text & _
Left$(txt, pos - 1) & to_str
txt = Mid$(txt, pos + from_len)
End If
Loop
ReplaceSubstring = new_text
End Function