Double Quote Characters in String Variables

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   

 

EnvisionCAD

EnvisionCAD

Since 1996, EnvisionCAD has been a nationally recognized leader in the configuration, customization, implementation, training & support for CAD software solutions. Our individualized approach has benefited private engineering firms and government agencies alike. Basic or advanced, we can help you get the most from your CAD technology.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *