ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.FileSearch crashed Excel in Windows 2K (https://www.excelbanter.com/excel-programming/334467-application-filesearch-crashed-excel-windows-2k.html)

Ken Loomis

Application.FileSearch crashed Excel in Windows 2K
 
I use the following code to search for specific files:

MyFilePath = "C:\Documents and Settings\trinaj\My Documents\"
' This is for 'trinaj's computer

MarkSub "starting filesearch next:FindOldFiles"
With Application.FileSearch
.NewSearch
.FileName = "*.xls"
.LookIn = MyFilePath
.SearchSubFolders = True
.TextOrProperty = "BuildStreetsReports"
.MatchTextExactly = False
.Execute
MarkSub "filesearch complete:FindOldFiles"

===========================

This code runs fine on a Windows 98 system (though it is slow) and runs fine
on a Windows XP system (very quick).

I tried to read the path to the user's "My documents" folder, but settled
for hard coding in that for this user (trinaj). I had the user open a
worksheet that read that and recorded it and then had he send me the
worksheet. Then I had her browse to her My Docs folder and copy the path and
email it to me. I got the same path each time (C:\Documents and
Settings\trinaj\My Documents\), so I am fairly assured that this is correct.

MarkSub records the passed text in an extra worksheet and saves the
workbook, and when I look at that sheet, "starting filesearch
next:FindOldFiles" is the last entry, so I think I can be certain that the
"Application.FileSearch" is where things bomb.

Can anyone suggest a solution? Possibly an alternative to using
"Application.FileSearch". This needs to be generic enough that I don't have
to have each user do any unusual configuration to make it work. The
multitude of users have Windows 98, Windows 2K and Windows XP.

TIA,
Ken






All times are GMT +1. The time now is 05:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com