逐行读取0001 2345 6789
0987 4577 1234
.....的文本文件

解决方案 »

  1.   

    逐行读取主要用LINE INPUT语句Private Sub Command1_Click()
        Dim FileNumber As Long
        Dim S As String
        FileNumber = FreeFile '找一个空的文件句柄
        Open "c:\abc.txt" For Input As #FileNumber
        Do While Not EOF(FileNumber)   '测试是否到文件尾
            Line Input #FileNumber, S  '读取一行到变量S
            MsgBox S                   '显示读取到的内容
        Loop
        Close #FileNumber
    End Sub
      

  2.   

    Dim ofso As New FileSystemObject  
    'project->references->microsofte scripting runtime (需要的dll库)Dim txtstream As TextStream
        Set txtstream = ofso.OpenTextFile(filepath, ForReading)
        Do Until txtstream.AtEndOfStream
            MsgBox txtstream.ReadLine
        Loop