run vbs from vba Syntax

J

Jerry V

i'm trying to run convert2pdf.vbs from vba:

Call Shell("WScript.exe """ & ThisWorkbook.Path & "\Convert2PDF.vbs"
vbMinimizedNoFocus)

Get message Syntax convert2pdf.vbs <Filename>

Can't figure out how to do this
 
J

joeu2004

Jerry V said:
Call Shell("WScript.exe """ & ThisWorkbook.Path & "\Convert2PDF.vbs",
vbMinimizedNoFocus)

Get message Syntax convert2pdf.vbs <Filename>
Can't figure out how to do this.

You are missing a double-quote after the path name. The correct syntax is:

Call Shell("WScript.exe """ & ThisWorkbook.Path & _
"\Convert2PDF.vbs""", vbMinimizedNoFocus)

or to minimize misreading in certain fonts:

Call Shell("WScript.exe " & Chr(34) & ThisWorkbook.Path & _
"\Convert2PDF.vbs" & Chr(34), vbMinimizedNoFocus)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top