How to make a variable equal to a value that includes quotes

  • Thread starter Thread starter JimRich
  • Start date Start date
J

JimRich

I am writing a VBA procedure.
I need the following for use in an IF function:

x=" "PT" "

I have tried x = " \ "PT" \"
 
VB uses quote marks to delineate the beginning and end of String constants,
so if you want use quote marks within a String constant, the VB way to
signal that is to use two adjacent quote marks within the text itself. The
statement you want is this...

x=" ""PT"" "
 
Not sure, but maybe x = " & " \ "PT" \" & "
The ampersand is for concatenating things.

HTH,
Ryan---
 
Thanks, that works.



Rick Rothstein said:
VB uses quote marks to delineate the beginning and end of String constants,
so if you want use quote marks within a String constant, the VB way to
signal that is to use two adjacent quote marks within the text itself. The
statement you want is this...

x=" ""PT"" "
 
Back
Top