Option Explicit
Sub test()
Dim defaultpath, arr, i, j, t, s
arr = ActiveSheet.[a1].CurrentRegion
defaultpath = ThisWorkbook.Path & "\upload"
If Len(Dir(defaultpath, vbDirectory)) = 0 Then MkDir defaultpath
Open defaultpath & "\" & ActiveSheet.Name & ".txt" For Output As #1
For i = 1 To UBound(arr, 1)
s = Trim(arr(i, 1))
For j = 2 To UBound(arr, 2)
t = Trim(arr(i, j))
If InStr(t, """") Then t = Replace(t, """", vbNullString)
If InStr(t, ",") Then t = Replace(t, ",", vbNullString)
If InStr(t, ".") Then t = Split(t, ".")(0)
s = s & vbTab & t
Next
Print #1, s
Next
Close #1
End Sub |