java写入txt文档,如何写入TEXT文档???

如何写入TEXT文档??? - 故障解答 - 电脑教程网

如何写入TEXT文档???

日期:2007-01-05   荐:
如何写入TEXT文档???我有一个COMMAND1的键。我想没一次点击COMMAND1将一条记录加在ERRLOGO.text中errlogo文件在我保存的目录下b=text1.text每一条记录占一行。请问应该怎么编写啊??我的教学书上很略。Sub CreateAfile Set fs = CreateObject("Scripting.FileSystemObject") Set a = fs.CreateTextFile("c:\testfile.txt", True) a.WriteLine(text1.text) a.CloseEnd Subopen filename for APPEND as #1这个是续写的代码:Private Sub Command1_Click()CreateAfileEnd SubSub CreateAfile() Set fs = CreateObject("Scripting.FileSystemObject") Set a = fs.OpenTextFile("c:\testfile.txt", 8, False, 0) a.WriteLine (.Text) a.CloseEnd Sub用上面那个代码就可以 text1 是文本框控件,每次点击Command1,就把换行内容新存到c:\testfile.txt中呵呵拿msdn改的~~Open App.Path & "\错误日志.txt" For Append As #1 '记录文件的路径Print #1, "错误: " & .text & " 时间:" & Now Close #1即可~~~
标签: