Excel2000 crashes when searching a networked drive
Posted by Matt on January 24, 2002 1:34 AM
I pinched this from the Xl help files and modified it to run wit a small user form, but if I run it against 2 mapped drives to 2 other machines XL crashes almost imediately and goes white. Can anyone help on this one? It's a little project to make my life a little bit easier, and it isn't.
Thanks
Sub GetAllFilesInDirectory()
Dim i
Dim SearchString As String
Dim LookIn As String
Dim Delimiter As String
SearchString = ufrmSearch.txtSearch.Text
LookIn = ufrmSearch.txtLookIn.Text
Delimiter = ufrmSearch.txtDelimit.Text
With Application.FileSearch
.NewSearch
.FileType = msoFileTypeAllFiles ' msoFileTypeExcelWorkbooks
.LookIn = LookIn
.Filename = SearchString
.SearchSubFolders = True 'true searches subfolders, false does not
.Execute
For i = 1 To .FoundFiles.Count
Range("A" & i) = .FoundFiles(i)
MyLen = Len(Range("A" & i))
Next i
End With
Columns("A:A").Select
'Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="\", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1))
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:=Delimiter, FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1))
'Columns("A:B").Select
'Selection.Delete Shift:=xlToLeft
'Columns("A:A").EntireColumn.AutoFit
End Sub