Sub AggregateFile()
On Error GoTo AggregateFile_Exit
'[b]Change this to the real directory[/b]
Const cstFilePath As String = "C:\"
Dim intIn As Integer, intOut As Integer, intTemp As Integer
Dim strFileName As String
Dim strIn As String, strTemp As String
'make an output directory
MkDir cstFilePath & "Out"
'create the output file
intOut = FreeFile
Open cstFilePath & "Out\Temp.csv" For Output As #intTemp
'Get the first file and make sure it exists
strFileName = Dir(cstFilePath & "*.csv")
If strFileName = "" Then GoTo AggregateFile_Exit
'Open the file
intIn = FreeFile
Open cstFilePath & strFileName For Input As #intIn
'Write data from the first in file to the out file
Do
Line Input #intIn, strIn
Write #intTemp, strIn
Loop Until EOF(intIn)
intTemp = FreeFile
'Do the rest of the files
Do While strFileName <> ""
Reset
strFileName = Dir
Open cstFilePath & "Out\Temp.csv" For Input As #intTemp
Open cstFilePath & strFileName For Input As #intIn
Open cstFilePath & "Out\All.csv" For Output As #intOut
Do
Line Input #intTemp, strTemp
Line Input #intIn, strIn
'If you need double quotes around the fields
'add them below ... & Chr(34) & strIn & Chr(34)
Write #intOut, strTemp & "," & strIn
Loop Until EOF(intIn)
Kill cstFilePath & "Out\Temp.csv"
FileCopy cstFilePath & "Out\All.csv", cstFilePath & "Out\Temp.csv"
Kill cstFilePath & "Out\All.csv"
Loop
AggregateFile_Exit:
Reset
Exit Sub
AggregateFile_Error:
Stop
End Sub