Dim checkpath As String
checkpath = "E:\a.txt Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
If Not (fso.FileExists(checkpath)) Then
Set f = fso.CreateTextFile(checkpath, True)
f.WriteLine (Label2.Caption)
f.Write ("User:")
f.WriteLine (txtUser.Text)
f.WriteLine ("The code of the 1st checking:")
f.WriteBlankLines (1)
f.WriteLine ("The start of the program:")
f.WriteLine (RichTextBox1)
f.WriteLine ("The end of the program")
f.Close
End If
checkpath = "E:\a.txt Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
If Not (fso.FileExists(checkpath)) Then
Set f = fso.CreateTextFile(checkpath, True)
f.WriteLine (Label2.Caption)
f.Write ("User:")
f.WriteLine (txtUser.Text)
f.WriteLine ("The code of the 1st checking:")
f.WriteBlankLines (1)
f.WriteLine ("The start of the program:")
f.WriteLine (RichTextBox1)
f.WriteLine ("The end of the program")
f.Close
End If
奇怪~你说的\par\tab是什么东西?是回车换行么?如果是的话,建议你先把richtextbox里的文本按行读出来,存在一个变量里,然后再写入文件
因为richtextbox是带格式的
open "C:\aa.txt" for output as #1
print richtextbox1.text , #1
close #12.
richtextbox1.savefile "C:\aa.txt", 1