adodb.stream如何读文件到数组

这篇文章将为大家详细讲解有关adodb.stream如何读文件到数组,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

Function filenum(filename,i)
Dim st,s 
Set st= CreateObject("ADODB.Stream")
st.Type = 2 '流类型为文本
st.Mode = 3 '模式为读写
st.Open
st.LineSeparator=13 
st.LoadFromFile filename
Do While Not St.EOS 
s = Split(st.readtext(), vbCrLf)   
Loop 
'MsgBox UBound(s) total
filenum=s(i)
st.Close
End function


MsgBox filenum("file.txt",2)

关于“adodb.stream如何读文件到数组”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。