SgtLoco
09-02-2003, 09:05 PM
I am trying to use app.path when calling a shell but I can't get it to work??
Function callexe()
Dim sPath As String
Dim shell
Set shell = CreateObject("WScript.Shell")
sPath = "App.Path \ course.exe"
'sPath = "App.Path \ course.exe"
'" & App.Path & "\mydata2.mdb
shell.Run " & App.Path & course.exe", 1, True
Squishy
09-02-2003, 09:09 PM
What version of VB are you using? I haven't seen shell.Run before. Also, unless this is intentional, look at the line where you assign a value to sPath. App.Path will not return a directory path if it is in quotes. It should probably be App.Path & "\course.exe".
[EDIT:] nvm the shell.Run thing...I need to read the code more carefully.
That's because you're putting App.Path inside the string literal, rather than referencing the App.Path variable. You need something more like sPath = App.Path & "\course.exe" -- there you see only the part in "" is the string literal, and the rest is interpreted at runtime.
SgtLoco
09-02-2003, 09:27 PM
Ok....I really don't need to put it in a variable but this works.
this worked in another program??
'Private Sub btnMkLic_Click()
'' Lets start MkLic to create licenses.
'Dim shell
'Set shell = CreateObject("WScript.Shell")
'shell.Run "E:\AcuODBCReg\mklic\mklic32.exe", 1, True
'End Sub ' btnAccess_Click
So I tried app.path like this:
sPath = App.Path & "\course.exe"
also tired
sPath = App.Path & "\course.exe"
not working>?>>>>>?????
SgtLoco
09-02-2003, 09:30 PM
also tried...
Function callexe()
Dim sPath As String
Dim shell
Set shell = CreateObject("WScript.Shell")
sPath = App.Path
shell.Run sPath & "\cource.exe", 1, True
End Function
SgtLoco
09-02-2003, 09:59 PM
this works !!
Function callexe()
Dim test
Set test = CreateObject("WScript.Shell")
test = shell(App.Path & "\course.exe", vbNormalFocus)
End Function ' btnAccess_Click
Thinker
09-02-2003, 10:08 PM
Take out completely that CreateObject call. It is doing absolutely
nothing. And Dim text As Long