You can use the Shell function that is part of VB.
Shell will only launch executable files, but you may add parameters along with it.
Or you can use the ShellExecute API function which will load any file with it's default application.Code:Shell "C:\MyProgram\Program.exe '/a /b /parameters 'You can also have it return a TaskID RetVal = Shell("C:\MyProgram\Program.exe /a /b /parameters", vbNormalFocus) Shell "Notepad.exe C:\MyFile.txt", 1
Code: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 Const SW_SHOWNORMAL = 1 Usage ShellExecute Me.hwnd, vbNullString, "C:\txtfile.txt", _ vbNullString, "c:\", SW_SHOWNORMAL




Reply With Quote