Sub ProcessTextFiles()
Dim folderName As String, filePathName As String, FileName As String
Dim WBName As String, DSName As String
folderName = "D:\Documents\Settings\Desktop\temp\"
FileName = Dir(folderName, vbNormal)
While FileName <> ""
filePathName = folderName & FileName
Workbooks.OpenText FileName:=filePathName _
, Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier _
:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:= _
False, Comma:=True, Space:=False, Other:=False
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
'do whatever you need to do to the file here.
'don't forget to close the file
FileName = Dir() 'this gets the name of the next file
Wend
End Sub