how to execute a VBScript file from a VB6 subroutine?

  • 14 years ago
    Hello,
    I was wondering if anyone could share with me the VB6 code that would execute a VBScript file named
    test.vbs
    in the subdirectory
    D:\test\
    thanks in advance,
    david





  • 14 years ago

    Hi,

    Check this:

    'DECLERATIONS TO RUN FILES



    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

    '--------------------------------------------

    Private Sub Command1_Click()

        ShellExecute 0&, vbNullString, "D:\test\test.vbs", vbNullString, vbNullString, vbNormalFocus

    End Sub

     

    Hope this works fine with you

  • 13 years ago

    Another solution for those who are searching for a similar solution for a Web Browser application.

    http://www.developmentfusion.co.uk/forums/thresd/63473/

    "Good software like good food takes time to prepare"

    Winnie-the-Pough

     

     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++ : Where friends have access to your private members.” - Gavin Russell Baker