除了打开该文件,然后用循环的方法一行行读取文件,直到文件尾的统计它的行数外,有没有其它更好、更快的方法实现?

解决方案 »

  1.   

    Dim temp As String
    Dim m As Long, n As LongOpen "c:\netlog.txt" For Input As #1
        m = LOF(1)
        temp = StrConv(InputB(m, #1), vbUnicode)
    Close #1n = Len(Replace(tmp, vbCrLf, ""))MsgBox m - n + 1
      

  2.   

    嗯,就是统计Vbcrlf的个数(回车换行) chr(10)+chr(13)
      

  3.   

    MsgBox CreateObject("Scripting.FileSystemObject").OpenTextFile("c:\test.txt", 8).Line