If you want to replace all occurances of a string, you can use the Replace function (only available in VB6.. you'll have to create your own if you have VB5 or lower).
Replace(StringToSearch, StringToFind,
ReplaceString, Start, Count, Compare)
The first 3 parameters speak for themselves.... The Start, Count and Compare paramters are all optional. Start specifies where to start replacing from, count specifies the maximum number of replaces, and compare specifies if it is case sensitive (vbBinaryCompare), or not (vbTextCompare).
The following code replaces all occurances of "Jane" with "Bob" in the Text1 textbox
Replace(Text1.Text, "Jane", "Bob")
Comments