Try this:
Sub testText()
Dim str As String
Dim AsT As String
Dim i As Long
On Error Resume Next
'create text string
For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
str = Cells(i, 11).Text & "^" & Cells(i, 12).Text & _
"^" & Cells(i, 2).Text & "^" & Cells(i, 14).Text & _
"^" & Cells(i, 15).Text & "^" & Cells(i, 16).Text & _
"^" & Cells(i, 17).Text & "|" & Cells(i, 18).Text & _
"|" & Cells(i, 19).Text & "|" & Cells(i, 20).Text & _
"^" & Cells(i, 21).Text & "^" & Cells(i, 22).Text _
& "^" & Cells(i, 8).Text & vbNewLine
Next i
Set AsT = CreateObject("ADODB.Stream")
'Specify stream type text/string data.
AsT.Type = 2
'Specify charset text data.
AsT.Charset = "utf-8"
AsT.Open
AsT.writetext str
'Save binary data To disk
AsT.SaveToFile "H:\001ExcelForum\2014\jan\30\TextFile.txt", 2
End Sub
Bookmarks