Quick Qestion about Handling String

This should be simple one for you experts.
I need it quick so big points.

i have the follwowing string
Dim EXECUTECMD As String
EXECUTECMD = "[FilePrintSilent(""c:\test.pdf"")]"

But i need to make the file path/name dynamic to include in the loop so how would i deal with the "" "" quotes.

Basically i need
filename as string
filename = "c:\test.pdf" or whatever the file name is

but i need it to be recognized as the string and not "filename"
the "" quotes has me stumped.
Thanks in advance.





DTRON04Asked:
Who is Participating?
 
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
Dim FileName As String
FileName = "c:\test.pdf"

Dim EXECUTECMD As String
EXECUTECMD = "[FilePrintSilent(" & Chr(34) & FileName & Chr(34) & ")]"
0
 
ShauliCommented:
Dim EXECUTECMD As String, myFileName As String
myFileName = "c:\test.pdf"
EXECUTECMD = "[FilePrintSilent(" & myFileName & ")]"

'or  if filename comes from a textbox then
Dim EXECUTECMD As String, myFileName As String
EXECUTECMD = "[FilePrintSilent(" & Text1.Text & ")]"

S
0
 
Erick37Commented:
You can insert quotes by using Chr(34)
34 is the character code for the double quote
Example:

Dim EXECUTECMD As String
Dim sFileName As String

sFileName = "c:\test.pdf"

EXECUTECMD = "[FilePrintSilent(" & Chr(34) & sFileName & Chr(34) & ")]"

MsgBox EXECUTECMD
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Erick37Commented:
Sharks!
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Lol...

Wasn't sure if DTRON04 needed the quotes around the filename or not...

Glad to see there was more than one way to interpret his wording.

=)
0
 
ShauliCommented:
lol... I wasn't sure either, decided without, but now I think you got it right and I didn't :)

S
0
 
DTRON04Author Commented:
thanks guys, idle was 1st and right.
sorry for the wording i had about 2 pints of coffee in my stomach that morning.
0
All Courses

From novice to tech pro — start learning today.