I have code behind a cmd button on my swichboard to find and run an external application. It works fine with Access 2K, but when I move the application to XP, it consistently returns 'No file found'. I even cut and pasted the VBA help example, and it returns file not found.
Any help would be appreciated.
My code as follows:
'Perform simple search using the FileSearch object.
Dim varItem As Variant
With Application.FileSearch
.NewSearch
.Filename = "HYD.exe"
.LookIn = "C:\"
.SearchSubFolders = True
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
.Execute
'Part II
If .Execute() > 0 Then
'MsgBox "There were " _
.FoundFiles.Count & _
" file(s) found."
'MsgBox .FoundFiles(1)
varItem = .FoundFiles(1)
Call Shell(varItem, 1)
Else
MsgBox "There were no files found."
End If
End With
thanks
BusMgr
Any help would be appreciated.
My code as follows:
'Perform simple search using the FileSearch object.
Dim varItem As Variant
With Application.FileSearch
.NewSearch
.Filename = "HYD.exe"
.LookIn = "C:\"
.SearchSubFolders = True
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
.Execute
'Part II
If .Execute() > 0 Then
'MsgBox "There were " _
.FoundFiles.Count & _
" file(s) found."
'MsgBox .FoundFiles(1)
varItem = .FoundFiles(1)
Call Shell(varItem, 1)
Else
MsgBox "There were no files found."
End If
End With
thanks
BusMgr