[已解决]读取数据文件(txt文件)并赋值给数据时出错
程序代码如下:
Private Sub Command1_Click()
CommonDialog1.ShowOpen
Dim files As String
files = CommonDialog1.FileName
Dim inbuf As String
Dim num As Integer
Open files For Input As #1 '打开文件
num = 0
Do While Not EOF(1) '获取文件行数
Line Input #1, inbuf
num = num + 1
Loop
ReDim a(1 To num)
For i = 1 To num '将每行数据赋值给数组a
Input #1, a(i) Next i
Close #1
End Sub
运行后显示如下错误:
实时错误 '62'
输入超出文件尾
请问哪里出错了?应该如何修改?谢谢!
[此贴子已经被作者于2006-12-29 16:00:48编辑过]