在自动执行数据库上的某些错误检查过程时遇到了问题。我需要输出一个与ListBox的输出相同的日志,但是我的当前(FreeFile)方法将在每次向该框添加新行时覆盖日志文件。
Sub ExampleString (s As String)
Dim n as Object
n = FreeFile()
Open "C:\Path\TEST.txt" For Output As #n
If Not listBoxOut Is Nothing Then
With listBoxOut
' add items to List Box
Print #n, s
' iterate through List Box
Close #n
End With
End If
End Sub
我如何以与在多个行中在ListBox中完成的方式相同的方式输出此文本?
谢谢,
Neuw
答案 0 :(得分:0)
仅处理打印文件语句,您必须:
integer
Append
关键字这是修改后的代码
Sub ExampleString(s As String)
Dim n As Integer
n = FreeFile()
Open "C:\Path\TEST.txt" For Append As #n
If Not listBoxOut Is Nothing Then
With listBoxOut
' add items to List Box
Print #n, s
' iterate through List Box
Close #n
End With
End If
End Sub