PDA

View Full Version : Solved: FileSearch



pepe90
10-21-2011, 01:30 PM
Hello, I'm having a problem using the FileSearch property. I get an error message on the third line of the following code which says that the object doesn't admit the property. I took the code from a post I read. Any idea how can I solve this problem? Thanks in advance.


Sub openAllfilesInALocation()
Dim i As Integer, wb As Workbook
With Application.FileSearch
.NewSearch
.LookIn = "C:\Documents and Settings\jmortsev\Mis documentos\Proyectos\Michael Lacroix"
.SearchSubFolders = False
.Filename = "*.xls"
.Execute
For i = 1 To .FoundFiles.Count
Set wb = Workbooks.Open(Filename:=.FoundFiles(i))
wbResults.Close SaveChanges:=False
Next i
End With
End Sub

p45cal
10-21-2011, 01:53 PM
Filesearch has been deprecated in xl 2007 up.
Explore fileSystemObject perhaps.