How to add double quotes in a string literal

Gopal picture Gopal · Dec 20, 2011 · Viewed 89k times · Source

Example code:

Dim a As String
a = 1234,5678,9123

I want to add literal double quotes to the variable a

Expected Output:

a = "1234,5678,9123"

How do I format the string so when I print it, it has double quotes around it?

Answer

Brian Hooper picture Brian Hooper · Dec 20, 2011

If you want to include " in a string, supply "" where you want the quote to appear. So your example should read...

a = """1234,5678,9123"""