Try this macro
Sub Test()
MyPath = "C:\temp\test\"
Close
MyFileName = Dir(MyPath & "*.txt")
Do While MyFileName <> ""
Counter = Counter + 1
MyString = ""
Open MyPath & MyFileName For Input As #1
Do While Not EOF(1)
Line Input #1, FileLine
MyString = MyString & FileLine & Chr$(10)
Loop
If MyString <> "" Then MyString = Left(MyString, Len(MyString) - 1)
Cells(Counter, 1) = MyPath & MyFileName
Cells(Counter, 2) = MyString
Close #1
MyFileName = Dir()
Loop
End Sub
You will need to adjust the value for the MyPath variable.
Open up the VBA editor by hitting ALT F11
Insert a new module by hitting Insert - Module
Paste the macro into the empty sheet
Hit ALT F11 to get back to the worksheet.
Run the macro by going to tools-macro in Excel 2003 or the view ribbon in Excel 2007.
Bookmarks