我有一個輸出到文本文件的Excel VBA宏。文本文件底部總是有一個空行,我無法擺脫它。任何有用的建議將不勝感激!由於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
末次
如果我只想爲最後一個空白行做什麼? – sbk 2017-08-07 06:08:18