Results 1 to 2 of 2
  1. #1

    DIR command (VB6 and Word97 VBA)

    I have been having some wierd happenings with the DIR command. Simply put, it will not show all the files meeting the criteria.

    Specifically, I have 300 *.doc files in a directory (this happens in both network drives and local drives). When I run the following code, it only prints out 199 of them. Suggestions?

    <pre>Public Sub thisisit()

    Dim MyPath As String
    Dim MyName As String

    MyPath = "C:COJKMainTesting*.doc" ' Set the path.
    MyName = Dir(MyPath, vbDirectory Or vbHidden Or vbArchive Or vbReadOnly _
    Or vbSystem) ' Retrieve the first entry.
    Do While MyName <> ""
    Debug.Print MyName
    MyName = Dir

    End Sub


  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Gold Lounger
    Join Date
    Feb 2001
    Dublin, Ireland, Republic of
    Thanked 0 Times in 0 Posts

    Re: DIR command (VB6 and Word97 VBA)

    It probably has more to do with the number of lines you can print to the immediate window, than any problem with your code.

    I think the maximum number lines is around 200.

    Andrew C

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts