编程实现两个文本的合并,要求将其中一个文件的所有内容添加到另一文件的尾部.

如题所述

'比如把2合并到1
Private Sub Command1_Click()
Dim s$, strTxt$
'读取文本
Open App.Path & "\2.txt" For Input Access Read As #1
Do While Not EOF(1)
Line Input #1, strTxt
s = s & strTxt & vbCrLf
Loop
Close #1

'输出文本
Open App.Path & "\1.txt" For Append As #1
Print #1, s;
Close #1
End Sub
温馨提示:答案为网友推荐,仅供参考
相似回答