|
Sub ReadExternalData
Dim fso, ts, s
Const ForReading = 1
Dim Num1, Num2, Ret
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile("c:\data.csv", ForReading)
Open
s = 1
while s <> eof
s = ts.ReadLine
if GetCSVCount(s) = 3 then
Num1 = GetCSVItem(s, 0)
Num2 = GetCSVItem(s, 1)
Ret = GetCSVItem(s, 2)
'msgbox(Num1 & "+" & Num2 & "=" & Ret)
Call Calc(Num1, Num2, Ret)
end if
wend
ts.Close
Close
End Sub
我有5条记录,可在读完之后还在继续读,然后就出错说
---------------------------
TestComplete
---------------------------
An exception occurred in the "Unit1" unit at line 50:
Microsoft VBScript 运行时错误
输入超出了文件尾
---------------------------
OK
---------------------------
请问,这里的while应该怎么写呀,怎么判断文件末尾,拜托了
|
|