Private Sub Form_Load()
Dim strT() As String
Open "z:\test.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, temp
ReDim Preserve strT(x) As String
strT(x) = temp
x = x + 1
Loop
Close #1
End Sub
无语了 我给的代码不就是 将每行内容保存在数组变量中么?
x=0 为第一行 msgbox strt(0)
msgbox strt(ubound(strt))即最后一行内容
Dim str( ) As String
用动态数组
Dim str() As String
redim str(a) ,A,B为数值
用Redim重定义,或者用动态数组