编程实现两个文本的合并,要求将其中一个文件的所有内容添加到另一文件的尾部.
1个回答
展开全部
'比如把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
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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询