• DIR Function

    Author
    Topic
    #461471

    Using strFilename = Dir(“” & oPath & “6*.xls”, vbHidden) one can recurse through a directory looking for files that begin with a 6.

    Is it possible to recurse through the directory and look for files that do not begin with a 4,5 or 6?

    Thanks,
    John

    Viewing 1 reply thread
    Author
    Replies
    • #1171068

      You can’t specify that in the Dir instruction itself. You should specify *.xls and test the filename within the loop:

      Code:
      Select Case UCase(Left(strFilename, 1))
        Case "4", "5", "6"
      	' Skip
        Case Else
      	' Code to process the file
      	...
      End Select
    • #1171069

      Hans,

      I was leaning towards your suggestion but I thought I would ask.

      Regards,
      John

    Viewing 1 reply thread
    Reply To: DIR Function

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: