Macro Help
Just change sDir to the name of the folder you want to import from,
not sure about the XML part though (I'm still on xl2k):
Sub TryThis()
Dim myBook As Workbook, _
ThisSheet As Worksheet, _
sDir, sFile As String
sDir = "C:\FolderName\"
sFile = "*.xls"
Set ThisSheet = ActiveWorkbook.Sheets(1)
With Application
.DisplayAlerts = False
With .FileSearch
.NewSearch
.LookIn = sDir
.Filename = sFile
.MatchTextExactly = True
If .Execute < 0 Then Exit Sub
For i = 1 To .FoundFiles.Count - 1
Set myBook = Workbooks.Open(.FoundFiles(i))
With myBook
.Sheets(1).Range("A1").CurrentRegion.Copy
ThisSheet.Range("A65536").End(xlUp).Offset(1,
0).PasteSpecial
.Close
End With
Next i
End With
.DisplayAlerts = True
End With
Set myBook = Nothing
Set ThisSheet = Nothing
End Sub
|