Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
FileSearch behaviour
FileSearch is producing duplicate results - listing the same file twice in
the FileSearch object. Additionally it's listing files outside the specified "C:\" drive. Some are found in the E drive, which is a flash stick. Even when this stick has been pulled out. Even when it's been pulled out and the computer restarted! I guess the search results are stored somewhere, but am clueless about the duplicates. Kevin. The code used: Public Sub SearchForXLsheets() Dim oFound As FileSearch Dim l As Long Set oFound = Application.FileSearch With oFound .NewSearch .LookIn = "C:\" .SearchSubFolders = True .FileType = msoFileTypeExcelWorkbooks .Execute SortBy:=msoSortByFileName If .FoundFiles.Count 0 Then For l = 1 To .FoundFiles.Count Cells(l, 1).Value = .FoundFiles(l) Next l End If Columns("A:A").EntireColumn.AutoFit End With Set oFound = Nothing End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
FileSearch behaviour
I have heard people say FileSearch is problematic, but never anything like
you describe. Here are some alternate approaches: http://support.microsoft.com/kb/185476/EN-US/ How To Search Directories to Find or List Files http://support.microsoft.com/kb/185601/EN-US/ HOW TO: Recursively Search Directories by Using FileSystemObject -- Regards, Tom Ogilvy "kjs" wrote in message ... FileSearch is producing duplicate results - listing the same file twice in the FileSearch object. Additionally it's listing files outside the specified "C:\" drive. Some are found in the E drive, which is a flash stick. Even when this stick has been pulled out. Even when it's been pulled out and the computer restarted! I guess the search results are stored somewhere, but am clueless about the duplicates. Kevin. The code used: Public Sub SearchForXLsheets() Dim oFound As FileSearch Dim l As Long Set oFound = Application.FileSearch With oFound .NewSearch .LookIn = "C:\" .SearchSubFolders = True .FileType = msoFileTypeExcelWorkbooks .Execute SortBy:=msoSortByFileName If .FoundFiles.Count 0 Then For l = 1 To .FoundFiles.Count Cells(l, 1).Value = .FoundFiles(l) Next l End If Columns("A:A").EntireColumn.AutoFit End With Set oFound = Nothing End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
FileSearch behaviour
"Tom Ogilvy" wrote in message ...
I have heard people say FileSearch is problematic, but never anything like you describe. Here are some alternate approaches: http://support.microsoft.com/kb/185476/EN-US/ How To Search Directories to Find or List Files http://support.microsoft.com/kb/185601/EN-US/ HOW TO: Recursively Search Directories by Using FileSystemObject -- Regards, Tom Ogilvy "kjs" wrote in message ... FileSearch is producing duplicate results - listing the same file twice in the FileSearch object. Additionally it's listing files outside the specified "C:\" drive. Some are found in the E drive, which is a flash stick. Even when this stick has been pulled out. Even when it's been pulled out and the computer restarted! I guess the search results are stored somewhere, but am clueless about the duplicates. Kevin. The problems all stemmed from having 'view hidden files & folders' checked. The system folders had references to the contents of the stick etc. Kevin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Filesearch in VB6 | Excel Programming | |||
FileSearch | Excel Programming | |||
FileSearch using VBA | Excel Programming | |||
.FileSearch | Excel Programming | |||
FileSearch Problem | Excel Programming |