ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Write " to a string (https://www.excelbanter.com/excel-programming/339475-write-string.html)

thyrmo

Write " to a string
 
Hi

I have to write a single " (quotation mark) to a string but excel takes
it as an delimiter.
Anyone has a bright idea

Thanks in advance
Crister


Ian

Write " to a string
 
MyString ="""

--
Ian
--
"thyrmo" wrote in message
oups.com...
Hi

I have to write a single " (quotation mark) to a string but excel takes
it as an delimiter.
Anyone has a bright idea

Thanks in advance
Crister




thyrmo

Write " to a string
 
Thanks for the quick reply
and as normal the simplest soultions are the best


dominicb[_116_]

Write " to a string
 

Good morning Thyrmo

The reference number for the " is 34. Therefor the following line
would place a single quote in a string contained in the variable a :

a=Chr(34)

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=465843


Charlie

Write " to a string
 
I think you mean

MyString = """"

Any time you want to embed quote marks in a quoted string they need to be
doubled up

Debug.Print "This is a ""quoted string"""

"Ian" wrote:

MyString ="""

--
Ian
--
"thyrmo" wrote in message
oups.com...
Hi

I have to write a single " (quotation mark) to a string but excel takes
it as an delimiter.
Anyone has a bright idea

Thanks in advance
Crister





Ian

Write " to a string
 
"Charlie" wrote in message
...
I think you mean

MyString = """"


No, thyrmo asked to write a single " into a cell, your solution writes ""
instead.

--
Ian
--



dominicb[_118_]

Write " to a string
 

Hi Ian

Try running this routine and see what you get.

Sub test()
a = """"
MsgBox a
End Sub

Dominic

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=46584


Tom Ogilvy

Write " to a string
 
Either works to produce just a single "double quote" as the result.

from the immediate window:

? """"
"
? """
"

--
Regards,
Tom Ogilvy

"dominicb" wrote in
message ...

Hi Ian

Try running this routine and see what you get.

Sub test()
a = """"
MsgBox a
End Sub

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile:

http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=465843





All times are GMT +1. The time now is 01:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com