Hello,
Prior to XL2007 the below worked. With the now defunct FileSearch, I am unable to execute this macro.
Thanks!
-------------------------------------------------
Sub Merge_DiffXLFilesSameFolder()
'
Dim I As Integer
Dim wbDest As Workbook
Dim wbSource As Workbook
Dim WS As Worksheet
Application.ScreenUpdating = False
Set wbDest = Workbooks.Add
With Application.FileSearch
.NewSearch
' Change Filepath Below To Suit
.LookIn = "T:\data"
.FileType = msoFileTypeExcelWorkbooks
.Execute
For I = 1 To .FoundFiles.Count
Set wbSource = Workbooks.Open(.FoundFiles(I))
For Each WS In wbSource.Worksheets
WS.Copy after:=wbDest.Worksheets(wbDest.Worksheets.Count)
Next WS
wbSource.Close
Next I
End With
Application.ScreenUpdating = True
End Sub
Prior to XL2007 the below worked. With the now defunct FileSearch, I am unable to execute this macro.
Thanks!
-------------------------------------------------
Sub Merge_DiffXLFilesSameFolder()
'
Dim I As Integer
Dim wbDest As Workbook
Dim wbSource As Workbook
Dim WS As Worksheet
Application.ScreenUpdating = False
Set wbDest = Workbooks.Add
With Application.FileSearch
.NewSearch
' Change Filepath Below To Suit
.LookIn = "T:\data"
.FileType = msoFileTypeExcelWorkbooks
.Execute
For I = 1 To .FoundFiles.Count
Set wbSource = Workbooks.Open(.FoundFiles(I))
For Each WS In wbSource.Worksheets
WS.Copy after:=wbDest.Worksheets(wbDest.Worksheets.Count)
Next WS
wbSource.Close
Next I
End With
Application.ScreenUpdating = True
End Sub