下面的代码测试通过,能够满足你的要求:
Option Explicit
Sub YgB()
Dim i, j, n, m, arr
For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row
n = "c:\" & Cells(i, 1) & ".txt"
m = Cells(i, Columns.Count).End(xlToLeft).Column
arr = Cells(i, 2).Resize(1, m - 1)
Open n For Output As #1
For j = 1 To m - 1
Print #1, arr(1, j)
Next j
Close #1
Next i
End Sub