Easy one - My string contains "

J

JT

Hello all

Hopefully there is an easy fix to this infuriating problem. I need to
include a string in my code which contains the character " - eg:

msgbox("They call me Phil "The Power" Taylor")

The problem is that when VBA sees " it takes it as the end of the
string and I get a compile error.

Has anybody come across this before, and is there a solution?

Thanks

JT
 
B

Bob Phillips

MsgBox "They call me Phil ""The Power"" Taylor"

or preferable IMO

MsgBox "They call me Phil 'The Power' Taylor"

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
J

JT

Thanks!

MsgBox "They call me Phil ""The Power"" Taylor"

or preferable IMO

MsgBox "They call me Phil 'The Power' Taylor"

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)










- Show quoted text -
 
A

Avi

You can also use

MsgBox "They call me Phil " & Chr(34) & "The Power" & Chr(34) & "
Taylor"
 
Top