How to concatenate double quotes

  • Thread starter Thread starter xRoachx
  • Start date Start date
X

xRoachx

I need to concatenate a string with double quotes but I
can't get it quite right:

strTempAppType = """ & cboAppTypes.Text & """

So if cboAppTypes.Text was NORTH, I want strTemAppType to
be equal to "NORTH", including the quotes. What is the
correct syntax? Thanks.
 
If you type:
"This "word" is in quotes" '<= Error!
VBA thinks the string ends when it hits the quote mark before Word, and then
has no idea what to do with the rest of the line. Therefore a quote inside
quotes has to be doubled, i.e.:
"This ""word"" is in quotes"

So, if you have nothing but a quote mark inside quotes, and it has to be
doubled, you end up with:
""""

Try:
strTempAppType = """" & cboAppTypes.Text & """"
 
That did the trick. Thanks for the info!
-----Original Message-----
If you type:
"This "word" is in quotes" '<= Error!
VBA thinks the string ends when it hits the quote mark before Word, and then
has no idea what to do with the rest of the line. Therefore a quote inside
quotes has to be doubled, i.e.:
"This ""word"" is in quotes"

So, if you have nothing but a quote mark inside quotes, and it has to be
doubled, you end up with:
""""

Try:
strTempAppType = """" & cboAppTypes.Text & """"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.




.
 
Back
Top