Link to home
Start Free TrialLog in
Avatar of BFanguy
BFanguyFlag for United States of America

asked on

Shell.Run with variables VBScript

This is what I need to start:
 shell.Run """\\CT01\Root\Visual_Documents\Vendors\V-ACACF-LAFAY\Checks\2014\42484.pdf"""
 
but I can't figure out how to encapsulate this in quotes.

I have tried:
  set shell = createobject("WSCRIPT.SHELL")
#1:
sThePDF = "\\CT01\Root\Visual_Documents\Vendors\V-" & VENDOR_ID & "\Checks\" & Check_YYYY & "\" & Check_Num & ".pdf"
#2:
Shell.Run sThePDF
#3:
Shell.Run ("sThePDF")
#4:
Shell.Run """\\CT01\Root\Visual_Doucments\Vendors\V-"" & VENDOR_ID & ""\Checks\"" & Check_YYYY & ""\"" & Check_Num & "".pdf""",1, True

None of these work. All give an error message.

I even tried:

 sThePDF = AddQuotes(sThePDF)
 sThePDF = AddQuotes(sThePDF)
 sThePDF = AddQuotes(sThePDF)
 Shell.Run sThePDF

No Error, but it just opens windows explorer.

Function AddQuotes(strInput)
    AddQuotes = Chr(34) & strInput & Chr(34)
End Function
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia 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
SOLUTION
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 BFanguy

ASKER

thanks guys... forest for the trees stuff...