-
Using character that are used by VBA
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
-
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).
-
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):
[VBA]
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
[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules