I got confused when I want to add double quotes and use concatenation in the meantime.
I understand if I want to show double quotes, I can use """a""", which will print "a" cause "a" is a string and two pairs double quotes will let the machine knows we want to show one pair.
But I don't understand the situation below:
Sub test()
Dim aVar As String
Dim bVar As String
Dim Parameters As String: Parameters = "a"
aVar = "param builtin=""" & "gaussian"""
bVar = """" & Parameters & """"
Debug.Print aVar 'print, param builtin="gaussian"
Debug.Print bVar 'print, "a"
End Sub
In the case above, for aVar, I get confused when " and & come together. I don't why we don't use "param builtin=" & """gaussian""", which is making more sense to me. What's the difference between them and why this also works?
For bVar, why we have 4 pairs double quotes but just print "a". In my understanding, we should print ""a"".
Can anyone help me to explain this two situations here? Thank you!