Easy one - My string contains "

  • Thread starter Thread starter JT
  • Start date Start date
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
 
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)
 
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 -
 
You can also use

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top