解决方案 »

  1.   

    Dim strLine As String, strItem() As String
    Dim Ulimit As Double, Llimit As Double, Depth As DoubleUlimit = Val(Text1)
    Llimit = Val(Text2)
    Open "C:\data\1.txt" For Input As #1
    Open "C:\data\2.txt" For Input As #2
    Do Until EOF(1) 
        Line Input #1, strLine
        Do While Instr(strLine, Space(2))
            strLine = Replace(strLine, Space(2), Space(1))
        Loop
        strItem = Split(strLine, Space(1))
        If Ubound(strItem) > 4 Then
            Depth = Val(strItem(0))
            If Depth >= Llimit And Depth <= Ulimit Then
                Print #2, strItem(0) & " " & strItem(3) & " " & strItem(4) & " " & strItem(5) 
            End if
        End if
    Loop
    Close #2
    Close #1
      

  2.   

    这个估计记录数上百万条了. 
    导ACCESS看看运行性能如何. 
    实在不行再换方法不过要是一次性的工作的话, 现成的文本文件, 手工也就几分钟的事.
      

  3.   

    If Ubound(strItem) > 4 是干嘛用的呢?能把每一语句的作用给解释下吗,万分感谢!
      

  4.   

    我的运行之后怎么不行呢,2.txt里没有数据,0 kb
      

  5.   

    本帖最后由 bcrun 于 2014-06-28 12:59:34 编辑
      

  6.   

    是空格的,还是不行,你能给把你的VB源代码发邮箱一份吗?[email protected],非常感谢!