I have a cmd button on a form that searches for and opens an external application. It appears to find the application okay, but it opens multiple copies of the application (2 - 5 copies to date), even though there is only one copy of the .exe file on the computer.
My code is as follows -
Private Sub cmdReedHyd_Click()
On Error GoTo Err_cmdReedHyd_Click
'Part I
'Perform simple search using the FileSearch object.
Dim varItem As Variant
With Application.FileSearch
.NewSearch
.Filename = "Hyd.EXE"
.LookIn = "C:\"
.SearchSubFolders = True
.Execute
'Part II
For Each varItem In .FoundFiles
Call Shell(varItem, 1)
Next varItem
End With
Exit_cmdReedHyd_Click:
Exit Sub
Err_cmdReedHyd_Click:
MsgBox Err.Description
Resume Exit_cmdReedHyd_Click
End Sub
Since I just use the 'Exit' button on the application, do I need to end or set to null the application in my VBA code?
Any help would be appreciated.
Thanks
BusMgr
My code is as follows -
Private Sub cmdReedHyd_Click()
On Error GoTo Err_cmdReedHyd_Click
'Part I
'Perform simple search using the FileSearch object.
Dim varItem As Variant
With Application.FileSearch
.NewSearch
.Filename = "Hyd.EXE"
.LookIn = "C:\"
.SearchSubFolders = True
.Execute
'Part II
For Each varItem In .FoundFiles
Call Shell(varItem, 1)
Next varItem
End With
Exit_cmdReedHyd_Click:
Exit Sub
Err_cmdReedHyd_Click:
MsgBox Err.Description
Resume Exit_cmdReedHyd_Click
End Sub
Since I just use the 'Exit' button on the application, do I need to end or set to null the application in my VBA code?
Any help would be appreciated.
Thanks
BusMgr