第一步:ATL+F11
第二步:在左邊當前工作簿雙擊當前工作表
第三步:在右邊空白處貼上如下程式碼
Sub txt()
On Error Resume Next
MkDir "d:\匯出TXT"
Dim i As Long, a As String, b As String
For i = 1 To Cells(65536, 1).End(xlUp).Row
a = Cells(i, 1)
b = Cells(i, 2)
Open "d:\匯出TXT\" & a & ".txt" For Output As #1
Print #1, b
Close #1
Next i
MsgBox "完成" & i & "條資料匯出"
End Sub
第四步:F5執行,匯出的TXT檔案在:d:\匯出TXT
第一步:ATL+F11
第二步:在左邊當前工作簿雙擊當前工作表
第三步:在右邊空白處貼上如下程式碼
Sub txt()
On Error Resume Next
MkDir "d:\匯出TXT"
Dim i As Long, a As String, b As String
For i = 1 To Cells(65536, 1).End(xlUp).Row
a = Cells(i, 1)
b = Cells(i, 2)
Open "d:\匯出TXT\" & a & ".txt" For Output As #1
Print #1, b
Close #1
Next i
MsgBox "完成" & i & "條資料匯出"
End Sub
第四步:F5執行,匯出的TXT檔案在:d:\匯出TXT