Need equivalent code for 2007

J

Jim May

This Code Worked EXCELLANT in 2003 - I'm having a time getting the equivalent
to work for me in 2007. Can someone assist me?
TIA,


Sub ListFiles()
Dim s As String
Dim sfolder As String
sfolder = Range("D1").Value
s = Range("B3").Value
Range("B4:B65536").ClearContents
s2 = "*" & s & "*.*"
With Application.FileSearch
.NewSearch
.LookIn = sfolder
.SearchSubFolders = True
.Filename = s2
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
ActiveSheet.Cells(i + 3, 2).Value = _
Mid(.FoundFiles(i), 64, 256)
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top