Link to home
Start Free TrialLog in
Avatar of DTRON04
DTRON04

asked on

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.





ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Shauli
Shauli

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
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
Sharks!
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.

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

S
Avatar of DTRON04

ASKER

thanks guys, idle was 1st and right.
sorry for the wording i had about 2 pints of coffee in my stomach that morning.