View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
David David is offline
external usenet poster
 
Posts: 39
Default Escaping Quotes problem

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.