putting double quotes in a string

A

Abdul Basit

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
 
R

RoyVidar

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"
 
B

Brendan Reynolds

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
 
Top