Link to home
Start Free TrialLog in
Avatar of afeld
afeld

asked on

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
Avatar of Dagor
Dagor

You can also use the common name for this as follows:

strFormattedString = Replace(strUnformattedString, "&", "")
 GetCleanString = strFormattedString
Avatar of afeld

ASKER

I tried that, and it still returned an XML document with the same error...  
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
ASKER CERTIFIED SOLUTION
Avatar of Chuckie_Ice
Chuckie_Ice

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of afeld

ASKER

I tried that, and it still returned an XML document with the same error...  
Avatar of afeld

ASKER

Still no luck...  
Avatar of afeld

ASKER

whoops, I am stupid.  I was cleaning it for &'s and for apostrophes, and it went back to the & before the second clean.   It works now.  Thanks!