My problem: I have created a form which asks from the user to locate those files using browse option. Then I ask the user to locate the executable. The next step is to copy the executable to those files directory. Everything is dandy uptil here, but when I use the shell to run that executable, the executable doesn't run from the directory where the files are.
the code:
Expand|Select|Wrap|Line Numbers
- Private Sub Command3_Click()
- Dim src As String
- Dim des As String
- Dim count As Integer
- Dim resDes As String
- Dim result As String
- Dim i As Integer
- Dim runExe As Double
- src = seiengFile ' this is the path i will be getting from user for executable
- des = sdrsFile ' path for the files on which executable will run
- 'this for loop parse the path in order to get to the folder containing the files
- 'when user locates the file, the path will contain the file name, so I am getting
- ' the folder name which contains those files.
- For i = 0 To Len(des)
- resDes = Mid(des, Len(des) - i, 1)
- If (resDes = "\") Then
- count = Len(des) - i
- Exit For
- End If
- Next i
- result = Left(des, count)
- MsgBox (count & " " & result) ' this shows me the right path
- FileCopy src, result + "SEIENG.exe"
- runExe = Shell(result & "SEIENG.exe", vbMaximizedFocus)
- End Sub