Drag Controls and Forms


Function SearchAndReplace(strToSearch, strToFind, strToReplaceWith) As String
Dim a As Long, b As Long, c As Long

a = 1
b = Len(strToFind)
c = Len(strToReplaceWith)

If b > 0 Then
    Do
        a = InStr(a, strToSearch, strToFind)
        If a < 1 Then Exit Do
        strToSearch = Left$(strToSearch, a - 1) & strToReplaceWith & Right$(strToSearch, Len(strToSearch) - (a + b - 1))
        a = a + c
    Loop
End If

SearchAndReplace = strToSearch

End Function




Mail to Daniel Wiman <daniel@wimania.com>
Online since June 1996, updated 990227
<- The VB home
<- Daniels homepage