Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Escaping Quotes problem

Try using the ascii value as per this:-

sScreenContents = Application.Substitute(sScreenContents, Chr(34), Chr(92))

I tested it and it works.

Regards,

OssieMac

"David" wrote:

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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MSN stock quotes - Error message "problem displaying attributes" jd Excel Discussion (Misc queries) 0 November 13th 07 10:34 PM
change straight quotes to curly quotes callico Excel Discussion (Misc queries) 2 June 22nd 07 10:23 PM
Problem: Copying a cell that contains line breaks adds extra quotes [email protected] Excel Discussion (Misc queries) 0 November 2nd 06 07:58 PM
How do i get historical stock quotes using MSN Money Stock Quotes Ash Excel Discussion (Misc queries) 0 May 11th 06 03:26 AM
Slight problem - routine to add quotes to a column [email protected] Excel Programming 2 August 15th 05 03:18 PM


All times are GMT +1. The time now is 07:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"