vb读取txt文件中的一列数,像这样 0 1 2 3 4 5 6 7 8 9 10把这些数读入到一个数组中

如题所述

Private Sub Command1_Click()
Dim a()
Open "c:\1.txt" For Input As #1
i = -1
While Not EOF(1)
Line Input #1, s
i = i + 1
ReDim Preserve a(i)
a(i) = Val(s)
Wend
Close #1
End Sub
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-11-14
用instr查找空格的位置,再用mid提取内容进入数组,用redim动态调整数组大小
相似回答
大家正在搜