光标后面如果有数据时写入时不能覆盖后面的数据
就像在文本中打字一样,把后面的文字往后推,而不是把后面的字覆盖掉。

解决方案 »

  1.   

    1.先把当前位置后的数据读到变量Temp中;
    2.写入你的数据;
    3.写入变量Temp中的内容。
      

  2.   

    Dim s As String
    Dim temp As String'将以前的内容读入temp变量
    Do While Not EOF(1)
    Open IIF(Right(App.Path,1)="\","","\") & "1.txt" For Input As #1
    Line Input #1,s
    temp=temp & s & vbCrlf
    Close #1
    Loop'将文本框中的文字与temp变量中的内容一起输入到1.txt文件中
    Open IIF(Right(App.Path,1)="\","","\") & "1.txt" For Output As #1
    Print #1,Text1.text & vbCrlf & temp
    Close #1
      

  3.   

    不好意思,将以下几句对调一下:Do While Not EOF(1)
    Open IIF(Right(App.Path,1)="\","","\") & "1.txt" For Input As #1
    改成
    Open IIF(Right(App.Path,1)="\","","\") & "1.txt" For Input As #1
    Do While Not EOF(1)Close #1
    Loop
    改成
    Loop
    Close #1