我文件夹下有4000多个.htm文件. 它给我枚举到999个就为止了. 1000后面的全丢下不管了.  
我目的是用来读取这些htm文件正则取里面的字符. 
有什么方法让它一次性全部遍历枚举完吗? 谢谢!strfile = Dir(App.Path & "\*.htm")
Do Until strfile = ""Open strfile For Input As #7
While Not EOF(7)                 'EOF为文尾测试函数
    Line Input #7, s                         '读入并放在临时字串中
Wend
Close #7
....    strfile = Dir
    
LoopMsgBox "完毕"

解决方案 »

  1.   

    把打开读取文件的代码注掉试试,以判断是哪里出了问题。
    strfile = Dir(App.Path & "\*.htm")
    Do Until strfile = ""'Open strfile For Input As #7
    'While Not EOF(7)                 'EOF为文尾测试函数
    '    Line Input #7, s                         '读入并放在临时字串中
    'Wend
    'Close #7
    '....
        Debug.Print strfile
        strfile = Dir
        
    LoopMsgBox "完毕"
      

  2.   

    没有判断"."与"..",可能会出问题.试试我这个封装好的模块看看:http://www.m5home.com/bbs/thread-2218-1-1.html调用很简单,添加模块后:'搜索文件模块测试过程
    'BY 嗷嗷叫的老马
    '紫水晶工作室
    'http://www.m5home.com/
    Dim I() As String, J As Long<I = SearchFileInPath("c:\windows\web", "*.*")
    For J = 0 To UBound(I)
        Debug.Print I(J)    '打印所有文件
    Next