Question: how to export data from excel to text file using vba?
Answer: Dim filename As String, lineText As String. ... 
filename = ThisWorkbook.path & "\" & Worksheets("Product Table").Name & ".txt" ... 
Open filename For Output As #1. ... 
Set myrng = Range("Table1") ... 
For i = 1 To myrng.Rows.Count + 1. ... 
lineText = IIf(j = 1, "", lineText & Chr(9)) & myrng.Cells(i - 1, j) ... 
Print #1, lineText.