Searching and replacing words from a text box

If i have a textbox with some text in it, how cand i search and replace a word let's say "word" with some other words "word number 2".
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

textbox1.text = Replace(textbox1.text, "word", "word number 2")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
if you know what the word is, and it's length, you could do something like the following

'z is length of "word", in this case 4'
z= 4
do until mid(textbox1.text,x,z) = "word"
textbox1.text = left(textbox1.text,x) & "word number 2" & right(textbox1.ext,x+z)
Or the old method:

a = "1234 word 5678"
 strToSearch = "word"
 strReplaceBy = "word number 2"
 start = 1
While InStr(start, a, strToSearch)
 a = Mid(a, 1, InStr(start, a, strToSearch) - 1) & strReplaceBy & Mid(a, InStr(start, a, strToSearch) + Len(strToSearch))
 start = start + Len(strReplaceBy)
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Here you go.

Private Sub Command1_Click()
Text1.Text = Replace(Text1.Text, "word", _
                "word number 2")

Text1.Text = Replace(Text1.Text, "word", _

Text1.SelStart = Len(Text1.Text)

End Sub
OK, i think im missing something here ! What is wrong with bobbit31's post. It's the best answer that fits this question, why make it so complex ?
lol, my thoughts exactly ;)
Some like it complex.
And it is only with an educational purpose.
macailaAuthor Commented:
I'll accept one answer as soon as I get VB6 I use VB4 so I get error messages.
macailaAuthor Commented:
Well bobbit31 was the first person who answered me and i try not to make my programs complex because that would mean they wouldn't run on older computers...
so why the 'B' grade?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.