View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Escaping Quotes problem

sScreenContents = Application.Substitute(sScreenContents, """", "\")


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"David" wrote in message
ups.com...
Hello, advice appreciated please.

I've got this line of VBA:

sScreenContents = Application.Substitute(sScreenContents, """", "\""")

The idea is to find any quotes in a string and escape them with a
backslash before outputting. The problem is that the output has

\""

rather than just the

\"

I was expecting, if I change the code to:

sScreenContents = Application.Substitute(sScreenContents, """", "\"")

the line is highlighted in red.

Any ideas of a way round this, or am I doing something wrong?

Thanks.