VBA Shell Function / Windows API Createprocess ()


  • I am trying to use the Windows API CreateProcess() to start a program within a VBA application.

    I have hit problems. Now going back to basics and trying to launch program, with parameters, from the VBA shell function.

    The appication starts sucessfully without the parameters ie

    Retval = Shell("C:\Program Files\FastCut\FastCut",6)

    Including parameters

    Retval = Shell("C:\Program Files\FastCut\FastCut 12345.txt,1,5",6)

    still launches the program but display errors.

    I get the same problems when trying the same thing via a createprocess() function.

    Using the ShellExecute function within the 'Shell32.dll' library ......

    strPathString = "12345" & ".txt" & ",1,5"

    RetVal = ShellExecute(0, "open", "C:\Program Files\FastCUT\fastcut.exe",  strPathString,  "C:\Program Files\FastCUT", 3)

    ...... everything works fine.

    Running .......

                 C:\Program Files\FastCut\FastCut 12345.txt,1,5

    ......from the command prompt causes no errors to be displayed and the program runs as it should.

    Can anyone help.

    Friday, May 19, 2006 5:23 AM