I'm sort of new to Excel VBA and need some help finding a work around for Application.FileSearch which is no longer supported. The idea is to fill an array with found jpeg file names for use on a form. I use the code below.
Set fs = Application.FileSearch
With fs
.LookIn = modelfolder
.filename = "*.JPG"
If .Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending) > 0 Then
ReDim pics(.FoundFiles.Count)
NOPIC = .FoundFiles.Count
For i = 1 To .FoundFiles.Count
filename = .FoundFiles(i)
pics(i) = Mid(filename, InStrRev(filename, "\") + 1)
Next i
End If
End With
Could someone help with a solution for this in Excel 2007?
Set fs = Application.FileSearch
With fs
.LookIn = modelfolder
.filename = "*.JPG"
If .Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending) > 0 Then
ReDim pics(.FoundFiles.Count)
NOPIC = .FoundFiles.Count
For i = 1 To .FoundFiles.Count
filename = .FoundFiles(i)
pics(i) = Mid(filename, InStrRev(filename, "\") + 1)
Next i
End If
End With
Could someone help with a solution for this in Excel 2007?