针对TXT文本中内容的读取问题,怎样能够一行一行读取,方法如下:
方法一:
Dim fso, MyFile,i,tmp
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.OpenTextFile("e:\51test.txt", 1 , False)
Do Until MyFile.AtEndOfStream/AtEndOfLine(两个都可以用)
tmp=MyFile.ReadLine
MsgBox tmp
loop
MyFile.Close
方法二:
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.OpenTextFile("e:\51test.txt", 1 , False)
While myfile.AtEndOfStream <> True
Tmp = Split(MyFile.Readline, ",")
username=tmp(0)
password=tmp(1)
MsgBox username &"/"& password
wend
MyFile.Close