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
不好意思,将以下几句对调一下: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
2.写入你的数据;
3.写入变量Temp中的内容。
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
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