VBA code to print a string in double quotes in excel

Below is the VBA code to put double quotes (quotation marks) for a string in excel. We can use CHR() function to print special characters like double quotes in excel VBA.

Chr(34) & stringToPrint & Chr(34)

Example:

Below is the VBA macro to print a string in double quotes (quotation marks (” “))

Sub printStringInDoubleQuotes()
Dim strinToPrint
stringToPrint = "string in double quotes"
MsgBox (Chr(34) & stringToPrint & Chr(34)) ' Printing the string in double quotes
End Sub

Output:

VBA-code-string-in-double-quotes

About the Author

SRINI S

A passionate blogger. Love to share solutions and best practices on wordpress hosting, issues and fixes, excel VBA macros and other apps

Leave a Reply

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