Double Quote Characters in String Variables

Published on June 17, 2013

Written by Rod Wing.

As you may know, when assigning a text string to a string variable the text is enclosed in “double quotes”. If you need to have a double quote character in the string simply precede the double quote character with another double quote character.

 

Sub QuoteMacro()

Dim strQuote As String

 

strQuote = “This string has no double quotes”

strQuote = “This string has “”double quotes“” in the middle”

strQuote = “””This string has a double quote at the beginning”

strQuote = ”This string has a double quote at the end”””

strQuote = “””This string has double quotes on both ends”””

 

‘The following string contains a single double quote character

strQuote = “”””

End Sub

 

Last Month’s VBA Tip – Save User Inputs as Default Settings

Don’t want to miss out on other great information? Subscribe to this blog or our monthly eNewsletter now!

Learn More ◊ Contact us today ◊ Newsletter ◊

EnvisionCAD Group EnvisionCAD YouTube Channel   

 


Tags:
Like this article? Share it!

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Privacy Policy