Trigger VBS from VBA ?

  • Hi All,


    Does anyone know how to trigger off a Visual Basic Script from VBA.


    I need to carry out a File System Object command outside of Excel (so the user can keep working) and have written a small VBS to do this. The problem I am having is trying to get it to run from VBA.


    Thanks


    AJW

  • Hi AJW


    You can use the Shell command to launch your script, e.g:

    Code
    Shell "wscript c:\winnt\scripts\test.vbs"


    HTH
    /Fredrik

  • Thanks Fwind,


    I've tried that for Windows 98 but it didn't work.


    Shell "wscript C:\WINDOWS\Update Package.vbs"


    Even tried moving the *.vbs file around to different locations and repathing the command but the same result.


    Keep getting an error message saying:


    "There is no file extension in "C:\WINDOWS\Update"


    Maybe I'm pathing it incorrectly ??


    Regards


    AJW

  • DHO!!


    Just figured it out.


    I'm using a space in the file name which Wscript is interpreting as a \ .


    Which means it was looking for a directory instead of a file.


    My correct code should now look like this:


    Shell "wscript C:\Windows\UpdatePackage.vbs"


    and not this:


    Shell "wscript C:\Windows\Update Package.vbs"


    Regards


    AJW

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!