1.打开文件,成添加状态 2.写入文件 3.关闭文件 filestring = App.Path & "\a.txt" Dim ofs As FileSystemObject Set ofs = New FileSystemObject Dim txtStream As TextStream Set txtStream = ofs.OpenTextFile(filestring, ForAppending) txtstream.WriteLine(写入的内容) '这个函数写入后自动换行 txtstream.Write(写入的内容) ‘这个函数不自动换行 txtStream.Close Set ofs = Nothing
open "d:\ddd.txt" for append as #1 print #1,"33.20,2157,"符号",123" close #1
Private Sub Command1_Click() Open "c:\xxxx.txt" For Binary As #1 Put #1, LOF(1) + 1, "symbol (33.20,2157,""符号"",123)" Close #1 End Sub
2.写入文件
3.关闭文件
filestring = App.Path & "\a.txt"
Dim ofs As FileSystemObject
Set ofs = New FileSystemObject
Dim txtStream As TextStream
Set txtStream = ofs.OpenTextFile(filestring, ForAppending)
txtstream.WriteLine(写入的内容) '这个函数写入后自动换行
txtstream.Write(写入的内容) ‘这个函数不自动换行
txtStream.Close
Set ofs = Nothing
print #1,"33.20,2157,"符号",123"
close #1
Open "c:\xxxx.txt" For Binary As #1
Put #1, LOF(1) + 1, "symbol (33.20,2157,""符号"",123)"
Close #1
End Sub