Filesearch y FoundFile en Excel 2007
Buen dia tengo el siguiente código que no funciona en Excel 2007
Sub CompileFiles()
Dim current_path As String
Dim file As Integer
Dim wbName As String
current_path = Left$(filePath, InStrRev(filePath, "\"))
With Application.FileSearch
.NewSearch
.SearchSubFolders = False
.LookIn = current_path
.FileType = msoFileTypeExcelWorkbooks
.Execute
' if we found some files to open:
If .FoundFiles.Count > 0 Then
' Stop screen flicker of workbooks being opened
Application.ScreenUpdating = False
' =============================================================
' Simple loop, opening the workbooks
For i = 1 To .FoundFiles.Count
Workbooks.Open (.FoundFiles(i))
wbName = ActiveWorkbook.Name
Workbooks(wbName).Sheets(1).Copy before:=Workbooks(macroFileName).Sheets("Template")
Workbooks(wbName).Close False
Next i
numberOfSheets = Workbooks(macroFileName).Sheets.Count - 1
End If
Application.ScreenUpdating = True
End With
End Sub
Gracias!!!!!