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. #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