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

解决方案 »

  1.   

    我这里为什么就没问题呢?
    奇怪~你说的\par\tab是什么东西?是回车换行么?如果是的话,建议你先把richtextbox里的文本按行读出来,存在一个变量里,然后再写入文件
      

  2.   

    f.WriteLine (RichTextBox1.Text)试试
      

  3.   

    同意楼上的,就是这个问题,应该加一个.Text
    因为richtextbox是带格式的
      

  4.   

    这个贴子已经有一个了,也是你发的吗?解决的方法是自己写保存文件的代码或者用RICHTEXTBOX提供的保存文件方法!1.
    open "C:\aa.txt" for output as #1
    print richtextbox1.text , #1
    close #12.
    richtextbox1.savefile "C:\aa.txt", 1
      

  5.   

    偶补充一下错误产生的根本原因:textbox的默认值是.text而richtextbox的默认值是.textRTF,而不是楼主想象的.text