Click to See Complete Forum and Search --> : Please Help - Trying to launch a program within VB...


rlecjr
March 22nd, 2001, 12:51 PM
I am writing an application that should launch an instance of another windows application, say Microsoft WORD. I have been able to launch the program from my code outside of the application, but I am trying to launch it within the application itself... in a control of some sort. Is this possible?? If it is, can someone help??

Thanks,
Ron

Iouri
March 22nd, 2001, 01:06 PM
'this sample will launch notepad.exe and wait until user closes it to continue execution

Function MyFunc()
Dim myObject As Object
Dim RetVal As Variant

Set myObject = CreateObject("WScript.Shell")
RetVal = myObject.Run("c:\windows\notepad.exe", 1, True)
MsgBox "Notepad is closed"

End Function


'TRue - wait until proc is over
'False don't wait

Iouri Boutchkine
iouri@hotsheet.com

rlecjr
March 22nd, 2001, 02:13 PM
Can this parameter be added for other applications as well? I am actually trying to launch another Windows application. What extactly is the WScript.shell??

Iouri
March 22nd, 2001, 03:26 PM
You can use it for any window application. WSShell is a window script host object. If you need you can find info in Microsoft knowledgebase

Iouri Boutchkine
iouri@hotsheet.com