我有一个Excel VBA宏,可以输出到文本文件。文本文件底部总是有一行空白行,我无法摆脱它。如果有任何有用的建议,将不胜感激!谢谢。
Sub testExport()
Dim fPath As String, exportTxt As String
fPath = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\Sample_" & Format(Now(), "HHNNSS") & ".txt"
exportTxt = "Project: Sample Output" & vbCrLf
exportTxt = exportTxt & "Model Version: 1 "
Open fPath For Append As #1 'write the new file
Print #1, exportTxt
Close #1
结束子程序