Como utilizar la nueva función de Excel FileSystemObject
Cuento con la función pero al pasar a excel 2010 ya no me funciona.
Me podrían ayudar?
Sub CopySheet()
Dim basebook As Workbook
Dim mybook As Workbook
Dim i As Long
Application.ScreenUpdating = False
Workbooks.Add
ChDir "C:\Macros\varios"
ActiveWorkbook.SaveAs Filename:= _
"C:\Macros\Final.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Range("A1").Select
ActiveCell.FormulaR1C1 = "canal"
Range("B1").Select
ActiveCell.FormulaR1C1 = "fecha"
Range("C1").Select
ActiveCell.FormulaR1C1 = "horario"
Range("D1").Select
ActiveCell.FormulaR1C1 = "marca"
With Application.FileSearch
'Application.FileSearch
.NewSearch
.LookIn = "C:\Macros\varios" ' Aquí esta el folder donde deben de estar los libros
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute() > 0 Then
Set basebook = ThisWorkbook
For i = 1 To .FoundFiles.Count
Set mybook = Workbooks.Open(.FoundFiles(i))
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Windows("Final.xls").Activate
Range("A2").Select
While ActiveCell.Value <> ""
ActiveCell.Offset(1, 0).Select
Wend
ActiveSheet.Paste
Next i
End If
End With
Columns("A:D").EntireColumn.AutoFit
Application.ScreenUpdating = True
End Sub
Gracias