8 replies
by andrew
If just want to spawn another app, try this code:
Dim hTask As Double
hTask = Shell("c:\winnt\notepad.exe", vbNormalFocus)
Just replace the first parameter with the path and file name of the EXE you want to lauch. This will kick off the EXE and immediately return control to your app.
If you need to run the EXE synchronously (wait for it to end before your app continues) here's a link to a technique:
http://support.microsoft.com/support/kb/articles/Q129/7/96.asp
(make sure there are no spaces in the URL)
by chinmoy_b
by chinmoy_b
I have done this...
##Dim hTask As Double
##hTask = Shell("c:\winnt\notepad.exe", vbNormalFocus)
But I want to publish a CD. Where the argument of SHELL will not be static (Like: "c:\winnt\notepad.exe"). What's the solution?
by mark.thomson
Change the string literal in the shell command to a string variable, which you can set any way you want eg From a dialogbox, registry setting, INI file etc
Dim hTask as Double
Dim sShellPath as string
sShellPath = "C:\winnt\notepad.exe"
'Could set this value from any number of 'sources
hTask= Shell(sShellPath, vbNormalFocus)
by chinmoy_b
by andrew
Are you familiar with the concept of variables? It's used rather widely in software development.
Try:
Public Sub LaunchIt(sProgram as String)
Dim hTask As Double
hTask = Shell(sProgram, vbNormalFocus)
End Sub
Then pass in anything you want.
You can popup a dialog to ask the user, a file browsing dialog, read it from a command line...any way you want.
by chinmoy_b
by chinmoy_b
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending