J0e B0b
Nov 17th, 1999, 07:27 AM
I have no clue how to do this...
I want to search for a EXE. Like VB.EXE for example.
After if finds VB.EXE, It will run that exe using SHELL command.
Thank you
venkatraman_r
Nov 17th, 1999, 01:52 PM
This will list all the files in a listbox..
Add a command button and a drive list control:
In the declarations of the form:
-------------------------------
Private Sub FindIt(sStartPath As String, sPattern As String)
On Error GoTo VenError:
Dim fso As FileSystemObject
Dim fld As Folder
Dim fldCurrent As Folder
Dim sFile As String
Screen.MousePointer = vbHourglass
Set fso = New FileSystemObject
If right$(sStartPath, 1) <> "\" Then
sStartPath = sStartPath & "\"
End If
Set fldCurrent = fso.GetFolder(sStartPath)
sFile = Dir(sStartPath & sPattern, vbNormal)
Do While Len(sFile) > 0
List1.AddItem sStartPath & sFile
sFile = Dir
Loop
VenError:
If Err.Number = 76 Then
MsgBox "Drive Access Error...Please Check Drive", vbOKOnly + vbCritical, "Drive Access Error"
End If
Screen.MousePointer = vbNormal
End Sub
*******************
In a command button
*******************
Call FindIt(Drive1.Drive & "\", "*.exe")
select the file from the listbox and use the shell command to run it.\
Hope it works.
Good Luck.
Venkat. :) :)