PDA

View Full Version : Using character that are used by VBA



john123
03-07-2005, 10:02 AM
Hi,

Me.PiclocA.Value = "c:\\pictures\\" + a + "\\" + "a.jpg"

I want to add a set of quotes round the text like this

Me.PiclocA.Value = ""c:\\pictures\\" + a + "\\" + "a.jpg""

However as quotes are part of the language it will not let me do it in VBA. How do I put the quotes in and make the language read them as text?

Thanks

Norie
03-07-2005, 11:52 AM
What do you actually want to put quotes around? It isn't clear from your post

By the way it is possible to do it.
You can either use multiple quotes """ or Chr(34).

mdmackillop
03-07-2005, 12:26 PM
Hi John,
Norie is quite right, but having dealt with multiple quotes in SQL code, it's easy to make a mistake. Try something like the following (names changed just to get the sub to run):

Sub nn()
a = "Test"
PiclocA = "c:\\pictures\\" + a + "\\" + "a.jpg"
Debug.Print PiclocA
pic1 = "c:\\pictures\\"
pic2 = "\\"
pic3 = "a.jpg"
PiclocA = Chr(34) + pic1 + a + pic2 + pic3 + Chr(34)
Debug.Print PiclocA

End Sub