急!请问怎样快速计算一文本文件的行数??多谢!

解决方案 »

  1.   

    文件读到Text中
    Option Explicit
    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Public Const EM_GETLINE = &HC4
    Public Const EM_GETLINECOUNT = &HBA
    Public Const EM_GETFIRSTVISIBLELINE = &HCEm_lngret = SendMessage(TxtMutiline.hwnd, EM_GETLINECOUNT, 0, 0)
    txtnumberoflines.Text = Str(m_lngret)
      

  2.   

    Private Sub Command1_Click()
         Dim arrBytes() As Byte
              Open "c:\aaa.txt" For Binary As 1
         ReDim arrBytes(1 To LOF(1))
         Get 1, , arrBytes
         Close 1
         MsgBox UBound(Split(StrConv(arrBytes, vbUnicode), vbCrLf))
    Erase arrBytes
    End Sub
      

  3.   

    Dim a() As String
    Dim b As String
    a = Split(b, vbCrLf)
    MsgBox UBound(a)
      

  4.   

    MsgBox CreateObject("scripting.filesystemobject").OpenTextFile("C:\aaa.txt", 8).Line
      

  5.   

    谢谢了,只是看不明白,要是要解释就好了
    hhjjhjhj(大头:6分
    northwolves(狼行天下) :6分
    online(龙卷风V2.0--再战江湖):8分