adodb.stream讀文件到數(shù)組的代碼
更新時間:2008年08月01日 23:34:53 作者:
用adodb.stream讀取文件并保存為數(shù)組的實現(xiàn)代碼
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)
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)
相關文章
用vbs實現(xiàn)配置無人登錄計算機時使用的屏幕保護程序
用vbs實現(xiàn)配置無人登錄計算機時使用的屏幕保護程序...2007-03-03VBS教程:函數(shù)-TimeSerial 函數(shù)
VBS教程:函數(shù)-TimeSerial 函數(shù)...2006-11-11