Sub テキストファイルタブ区切り一括出力()
Dim buf As String
Dim delimiter As String
Dim row As Range, clm As Range
Dim ws As Worksheet
Dim outputTxt As String
Dim outputFilePath As String
Dim fileNo As Integer
Set ws = ThisWorkbook.Sheets("Sheet1")
delimiter = vbTab
For Each row In ws.UsedRange.Rows
buf = ""
For Each clm In row.Columns
buf = buf & clm.Value
If clm.Column < row.Columns(row.Columns.Count).Column Then
buf = buf & delimiter
End If
Next
If outputTxt = "" Then
outputTxt = buf
Else
outputTxt = outputTxt & vbCrLf & buf
End If
Next
outputFilePath = "C: emp est.txt"
fileNo = FreeFile()
Open outputFilePath For Output As #fileNo
Print #fileNo, outputTxt
Close #fileNo
End Sub