VBA - " double quote within the string variable


Posted by Mindy on May 31, 2001 8:50 AM

How do I assign the " into the string in the macro?

ex:

dim String as string

String = "This is the Test only." & """ & "double ok" & """ & "."


The string output value I am looking for is something like
this

This is the test "double ok".


""" does not work for me, what else should I try.

Thank you for helping

Posted by Russell on May 31, 2001 8:55 AM

Re: VBA -


The way I like is to include chr(34), which is the double quote.

For example,

str = chr(34) & "There should be a double quote before and after this sentence" & chr(34)

str should equal "There should be a double quote before and after this sentence" (with quotes included).

Posted by Mindy on May 31, 2001 8:55 AM


Sorry, I found the solution now.

I can use

String = "This is the Test only." & chr(34) & "double ok" & chr(34) & "."


Posted by dax on May 31, 2001 8:56 AM

Hello,

Try using Chr(34) which return the character associated with the specified ASCII code - in this case the "

S = "This is the Test only." & Chr(34) & "double ok" & Chr(34) & "."


HTH,
Dax.



Posted by asf on May 31, 2001 8:59 AM