Application.FileSearch özelliğinde '445' hatası alıyorum. Aşağıdaki macroları deneyebilir misiniz? bende mi bi sorun var acaba...:???:
Kod:
Sub aaa()
Dim ss As SearchScope
Dim sf As ScopeFolder
Dim lngCount As Long
With Application.FileSearch
.NewSearch
.FileType = msoFileTypeWebPages
.FileTypes.Add msoFileTypeExcelWorkbooks
For lngCount = 1 To .SearchFolders.Count
.SearchFolders.Remove lngCount
Next lngCount
For Each ss In .SearchScopes
Select Case ss.Type
Case msoSearchInMyComputer
For Each sf In ss.ScopeFolder.ScopeFolders
Call OutputPaths(sf.ScopeFolders, "1033")
Next sf
Case Else
End Select
Next ss
If .SearchFolders.Count > 0 Then
.LookIn = .SearchFolders.Item(1).Path
If .Execute > 0 Then
MsgBox "Files found: " & .FoundFiles.Count
For lngCount = 1 To .FoundFiles.Count
If MsgBox(.FoundFiles.Item(lngCount), vbOKCancel, _
"Found files") = vbCancel Then
lngCount = .FoundFiles.Count
End If
Next lngCount
End If
End If
End With
End Sub
Sub OutputPaths(ByVal sfs As ScopeFolders, ByRef strFolder As String)
Dim sf As ScopeFolder
For Each sf In sfs
If LCase(sf.Name) = LCase(strFolder) Then
sf.AddToSearchFolders
End If
DoEvents
If sf.ScopeFolders.Count > 0 Then
Call OutputPaths(sf.ScopeFolders, strFolder)
End If
Next sf
End Sub