I am currently trying to get a solution for the application.filesearch code that is no longer present in Excel 2007. I have done some searching and not sure if using the Dir method will work for my situation. Basically all I am trying to do is search a specific folder for the .txt files in it and hyperlink link them as a way for the user to have a quick check list to be sure they are checking all the files. Can someone please give me a hand? Thanks.
Code:
Sub getfilename()
Sheets("FileChooser").Select
Range("B1:B1000").Select
Selection.ClearContents
Dim i As Long
With Application.FileSearch
.NewSearch
.LookIn = "O:\americolddatafiles\receivedfiles\UnProcessed\"
.Filename = "*.txt"
.SearchSubFolders = False
.MatchTextExactly = False
.TextOrProperty = "ISA*"
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Sheets("FileChooser").Select
Range("B" & Rows.Count).End(xlUp).Offset(1).Select
ActiveSheet.Hyperlinks.Add anchor:=Selection, Address:=.FoundFiles(i)
Next i
End If
End With
End Sub