Replace part of a string by another string

C

cyberdude

Hi,

I want to replace part of a string by another string. For example,

Dim A as string

A="I have a car. He has a house"

If "car" is to be replaced by "boat", how can I do that?

(So, A becomes "I have a boat. He has a house")

Thanks.

Mike
 
J

Jonathan West

cyberdude said:
Hi,

I want to replace part of a string by another string. For example,

Dim A as string

A="I have a car. He has a house"

If "car" is to be replaced by "boat", how can I do that?

(So, A becomes "I have a boat. He has a house")

B = Replace(A, "car", "boat")
 
H

Helmut Weber

Hi Mike,

see help on replace function.


--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top