Option Explicit Private Sub Command1_Click() Dim file_1, file_2 As String '文件名 file_1 = "f:123.txt" file_2 = "f:456.txt" Dim abc As String '所读取的文本文件的所有内容 Dim xyz As String '在循环中存放每行的内容 Open file_1 For Input As #1 Open file_2 For Append As #2 Do While Not EOF(1) '循环直至文件尾 Line Input #1, xyz '每次读取一行存放在xyz变量 abc = abc & xyz & vbCrLf 'vbCrLf=Chr(13) + Chr(10) 回车符+换行符 Loop Print abc '打印 Write #2, Now & vbCrLf & abc Close Name "f:123.txt" As "f:/123/789.txt" '修改123.txt的路径和文件名 End Sub
posted on 2008-12-24 10:32 台哥编程课堂 阅读(284) 评论(0) 编辑 收藏 举报