putting double quotes in a string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to add double quotes in as string. The string gets value from other
variable as well.

Suppose
myvariable = "Sam"

"Hello " & [myvariable] &" Good day".

I want that output with myvariable value in double quotes like

Hello "Sam" Good day
 
Abdul Basit wrote in message
I want to add double quotes in as string. The string gets value from other
variable as well.

Suppose
myvariable = "Sam"

"Hello " & [myvariable] &" Good day".

I want that output with myvariable value in double quotes like

Hello "Sam" Good day

Couple of versions:

MsgBox "Hello """ & myvariable & """ Good day"
MsgBox "Hello " & chr$(34) & myvariable & chr$(34) & " Good day"
 
Public Sub QuotesInString()

Dim myVariable As String

myVariable = "Sam"
Debug.Print "Hello """ & myVariable & """ Good day"

End Sub

Result in Immediate window ...

QuotesInString
Hello "Sam" Good day
 
Back
Top