ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   run vbs from vba Syntax (https://www.excelbanter.com/excel-programming/446939-run-vbs-vba-syntax.html)

Jerry V

run vbs from vba Syntax
 
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.

joeu2004[_2_]

run vbs from vba Syntax
 
"Jerry V" wrote:
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)




All times are GMT +1. The time now is 01:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com