Cannot use parentheses when calling a Sub Error 800A0414 VBS

后端 未结 3 1532
既然无缘
既然无缘 2020-11-27 06:40

I am getting the 800A0414 error in lines 7 and 12 of this script:

Module Module1

  Dim p

    Sub Main()
        CreateObject(\"Wscript.Shell\").Run(\"progr         


        
3条回答
  •  温柔的废话
    2020-11-27 07:18

    Seems to me this is a VB.NET, not VBScript code. You have Shell function in VB.NET (and other methods).

    Anyway, Run returns any error code returned by the program, and if you store that result in a variable, you can use parentheses in this case.

    Dim lResult As Long
    lResult = CreateObject("Wscript.Shell").Run("program.bat", 0, True)
    

    The rest was answered by @Helen.

提交回复
热议问题