Sub ProcessFilesInFolder()
Dim folderName As String, filePathName As String, FileName As String
Dim WBName As String, DSName As String
folderName = "C:\temp\" 'Change this to your directory
FileName = Dir(folderName & "*.xls", vbNormal)
While FileName <> ""
filePathName = folderName & FileName
Workbooks.Open FileName:=filePathName
WBName = ActiveWorkbook.Name 'use WBName to refer to the name of the current workbook
DSName = ActiveSheet.Name 'use DSName to refer to the name of the worksheet
'that was created when you opened the text file
'***********your code here*************
'do whatever you need to do to the file here.
MsgBox (WBName) 'this is just for testing...remove it when you know you're getting the files you want
'***********end of your code here*************
Workbooks(WBName).Close SaveChanges:=True
FileName = Dir() 'this gets the name of the next file
Wend
End Sub