Can someone help me please.. I need to make this macro work in excel 2010...
thanx in advance
Function FileList(folder As String, match As String, subfolders As Boolean)
Dim list() As String, file As String
Dim i As Integer
i = 0
Set Search = Application.FileSearch
With Search
.NewSearch
.LookIn = folder
.Filename = match
.SearchSubFolders = subfolders
total = .Execute()
If total > 0 Then
ReDim list(total - 1)
For Each el In .FoundFiles
file = CStr(el)
list(i) = file
i = i + 1
Next
Else
ReDim list(0)
list(0) = "()"
End If
End With
FileList = list()
Set Search = Nothing
End Function
Bookmarks