大家来看看这段代码有什么问题,先谢了

来源:百度知道 编辑:UC知道 时间:2024/06/15 01:22:11
Private Sub Command1_Click()
Dim aa, bb As String
aa = ""
bb = ""
Open App.Path & "\1.txt" For Binary As #1
Do While Not EOF(1) ' 循环至文件尾。
bb = Input(1, #1) ' 读入一个字符。
aa = aa + bb
Loop
Debug.Print aa ' 显示到立即窗口。
Close #1
On Error Resume Next
Kill App.Path & "\2.txt"
Open App.Path & "\2.txt" For Binary As #2
Put #2, , aa
Close
End Sub
1.txt和2.txt的内容不一样,这段代码应该怎样修改才使两个文件一样,我的目的不是复制文件。

Private Sub Command1_Click()
Dim bb As Integer
Open App.Path & "\1.txt" For Binary As #1
On Error Resume Next
Kill App.Path & "\2.txt"
Open App.Path & "\2.txt" For Binary As #2
Do While Not EOF(1) ' 循环至文件尾。
Get #1, , bb ' 读入一个字符。
Put #2, , bb
Loop
Close #1
Close
End Sub