Option Explicit
Sub Create_Txt_File()
Dim mypath As String, myfile As String
Dim data As String
Dim r As Long
On Error Resume Next
mypath = "c:\test\"
Kill mypath & "*.csv" 'this will delete all that file type within that folder
On Error GoTo 0
For r = 2 To Cells(Rows.Count, "A").End(xlUp).Row
data = Cells(r, "B") & "," & Cells(r, "C") & "," & Cells(r, "D")
myfile = Cells(r, "A") & ".csv"
If Dir(mypath & myfile) = "" Then 'file does not exist - write the header row
Open mypath & myfile For Append As #1
Print #1, [B1] & "," & [C1] & "," & [D1]
Close #1
End If
Open mypath & myfile For Append As #1
Print #1, data
Close #1
Next r
End Sub