...

View Full Version : VB: launch an app, cant get it to work, but it should do



Anthony2oo4
02-04-2005, 11:25 PM
Ok guys i have a file list box that is set to show the files of a certain folder. I wwant to have it so that when an item is selected in the box, it executes the file and it runs. I have this so far, but keep getting errors.

Private Sub File1_Click()
openselected
End Sub

Public Sub openselected()
SelectedFilePath = File1.Path
SelectedFileName = File1.FileName
Shell SelectedFilePath & "\" & SelectedFileName
End Sub

Iv also used this line

Shell (SelectedFilePath & "\" & SelectedFileName)

and

Shell ("SelectedFilePath & "\" & SelectedFileName")

Why isnt this working and also is it possible that whateva is show in the box, that the file extention can be take off it.

Thanks for your time. ;)

Anthony2oo4
02-09-2005, 03:27 PM
Can anyone tell me why this aint working?

sage45
02-09-2005, 04:36 PM
Try using:

Shell SelectedFilePath + "\" + SelectedFileName

HTH,

-sage-

tboss132
02-09-2005, 05:02 PM
Try this

dim progpath as string
progpath = SelectedFilePath & "\" & SelectedFileName & ".exe"

Shell(progpath)

You can first display progpath's contents to examine the string. The problem might be in the variables themselves.

Anthony2oo4
02-11-2005, 08:48 PM
Thank you both for your reply, but sage45, your one give me the same error I was already having, "invalid procedure or argument" then u click debug and it goes to the shell line.

and tboss your method said file not found :confused:

Any other methods? :thumbsup:


You can first display progpath's contents to examine the string. The problem might be in the variables themselves.

I already done that with my method in my first post above, I used a msgbox and it showed the correct link, it just wonr run it :confused: ;)

tboss132
02-12-2005, 11:37 AM
Compile your code. Copy your code's executable into the same directory of the executable you're trying to launch. Use relative file names.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum