【发布时间】:2018-03-02 11:31:04
【问题描述】:
我正在使用下面的 VBA 代码将 Excel 行导出到单个文本文件(文件名为 B 列)
Sub ExportTextFiles()
Dim i As Long
Dim LastDataRow As Long
Dim MyFile As String
Dim fnum
LastDataRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LastDataRow
'The next line uses the contents of column B on the same row to name it
MyFile = "C:\test\" & ActiveSheet.Range("B" & i).Value & ".txt"
fnum = FreeFile()
Open MyFile For Output As fnum
Print #fnum, Format(Range("A" & i))
Close fnum
Next i
End Sub
我的问题是文本中导出的行只有 255 个字符。 有解决方法吗?
【问题讨论】:
-
在
Print语句中丢失Format函数