如果换成do until 可能会好点。
dim stm as string
dim i as integer
open "temp.txt" for input as #1
redim s1(1 to lof(1)) as string
redim s2(1 to lof(1)) as string
do until eof(1)
line input #1, stm
i=i+1
s1(i)=left(stm,2)
s2(i)=right(stm,len(stm)-3)
loop
close #1
dim stm as string
dim i as integer
open "temp.txt" for input as #1
redim s1(1 to lof(1)) as string
redim s2(1 to lof(1)) as string
for i=1 to lof(1)
line input #1, stm
s1(i)=left(stm,2)
s2(i)=right(stm,len(stm)-3)
next i
close #1
Dim Num1, Num2
dim array1(),array2()
dim arrnum as integer '记录数组长度
arrnum=0
redim array1(arrnum)
redim array2(arrnum)
Open "temp.txt" For Input As #1 ' 打开输入文件。
Do While Not EOF(1) ' 循环至文件尾。
Input #1, Num1, Num2 ' 将数据读入两个变量。
arrnum=arrnum+1
redim preserve array1(arrnum)
redim preserve array2(arrnum)
array1(arrnum-1)=val(num1)
array2(arrnum-1)=val(num2)
Loop
Close #1 ' 关闭文件。
dim filetxt as string,wendu(1 to 4000) as integer,shijian(1 to 4000)as integer
dim temps,lines
filetxt = String(FileLen("temp.txt" ), " ")
Open txtpath For Binary As 1
Get #1, , filetxt
Close 1
temps=split(filetxt,vbcrlf)
for i=1 to 4000
lines=split(temps(i-1)," ")
wendu(i)=lines(0)
shijian=lines(1)
set lines=nothing
next