Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Escape for special characters in string

I want to be able to put:

.InsertLines StartLine, " sheetName = ActiveSheet.name & "sheetName""

to generate the code section of a button click procedure. The problem is the
embeded
double quote. In C/C++ one would write the embedded double quote as \",
i.e., the
\ "escapes" the string interpretation to treat the followin character
literally.

Is there such a concept in VBA? I've tried putting Chr(42) but this does not
generate the wanted
code.

Ed



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Escape for special characters in string

The escape character is actually the doublequote itself "

As an example:
msgbox """"
Would display just the one doublequote.

Rob


"Jag Man" wrote in message
...
I want to be able to put:

.InsertLines StartLine, " sheetName = ActiveSheet.name & "sheetName""

to generate the code section of a button click procedure. The problem is

the
embeded
double quote. In C/C++ one would write the embedded double quote as \",
i.e., the
\ "escapes" the string interpretation to treat the followin character
literally.

Is there such a concept in VBA? I've tried putting Chr(42) but this does

not
generate the wanted
code.

Ed





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Escape for special characters in string

Jag Man,

In VBA
Chr(34)
would be your quote symbol.

To enclose a quote in VBA you have to enclose it in quotes.
e.g.
"""
would give you a quote mark.

As an example:

Range("A1").Formula="=IF(D1=""Y"",1,2)"
Excel would write that formula into Cell A1 as:
=IF(D1="Y",1,2)

John

"Jag Man" wrote in message
...
I want to be able to put:

.InsertLines StartLine, " sheetName = ActiveSheet.name & "sheetName""

to generate the code section of a button click procedure. The problem is

the
embeded
double quote. In C/C++ one would write the embedded double quote as \",
i.e., the
\ "escapes" the string interpretation to treat the followin character
literally.

Is there such a concept in VBA? I've tried putting Chr(42) but this does

not
generate the wanted
code.

Ed





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
Insert Leading Characters If String Is Only 7 Characters Paperback Writer Excel Discussion (Misc queries) 2 April 21st 09 09:07 PM
special Characters P. Zicari Excel Discussion (Misc queries) 2 October 22nd 07 04:09 PM
Special characters Matthew S Excel Discussion (Misc queries) 10 September 24th 05 12:36 AM
special characters tjh Excel Worksheet Functions 3 May 13th 05 10:50 PM
Special characters Gilles Desjardins Excel Worksheet Functions 2 December 8th 04 04:17 AM


All times are GMT +1. The time now is 12:08 PM.

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

About Us

"It's about Microsoft Excel"