How do I replace "&" in vb6?

hi, I know that

strFormattedString = Replace(strUnformattedString, Chr(39), "")
  GetCleanString = strFormattedString

will replace an apostrophe with a blank, but is there a # that will replace an ampersand?   My XML document is not happy with them in it...  
  Thanks in advance!

 -Al
afeldAsked:
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.

Chuckie_IceCommented:
just do this:

strFormattedString = Replace(strUnformattedString, "&" ,"")
 GetCleanString = strFormattedString
0
Chuckie_IceCommented:
to answer this in the way your looking for, & = 38

strFormattedString = Replace(strUnformattedString, Chr$(38), "")
GetCleanString = strFormattedString

Also, i used Chr$(38) instead of Chr(38),this may help
0
CareyJCommented:
'&' is an XML entity.  If you want to write it into your string you'll need to escape it like this:

strFormattedString = Replace(strUnformattedString, Chr(38), "&")

Here are some other XML entities that you might have problems in XML strings:

> = >
< = &lt;
" = &quot;
' = &apos;
0

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
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.

Richie_SimonettiIT OperationsCommented:
hearing...
0
Hornet241Commented:
I have had to do the same thing and CareyJ has the right answer.

0
RhaedesCommented:
At the moment your XML is just complaining about the ampersand, so you can do a replace as others have said.

If, however, there is any chance that other characters might pop up in the future (foreign names, quotation marks etc), a global solution is to replace all these 'dodgy characters' in the XML with entities (numeric or otherwise) using the free tidy.dll

http://perso.wanadoo.fr/ablavier/TidyCOM/

Rhaedes
0
afeldAuthor Commented:
Thanks, that is a big help!
0
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.