Consulting

Results 1 to 7 of 7

Thread: Dir function returns fileNames not as expected

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Mentor tstav's Avatar
    Joined
    Feb 2008
    Location
    Athens
    Posts
    350
    Location

    Dir function returns fileNames not as expected

    Hi everybody,

    This came up while testing code for the thread "Incremental number for saved files".
    I find this to be too generic by itself though, so I'm opening this thread.

    Here we go: In order to have the Dir function return files, a path and a pattern can be specified as the function's parameter.
    e.g. strFile = Dir(strPath & "\" & "VBAX" & "*")

    Fine.

    Now I expect this function to return all files from the specified path that start with "VBAX", right? e.g. 'VBAX.xls', 'VBAXall.txt', 'VBAX Forum.doc' and so on.

    I also expect it to ignore files like 'VB AXIS.xls', 'V B A X.doc' because they just don't match the pattern I entered, right?

    And how about 'VB A X.txt' for crying out loud (6 spaces and 2 spaces here, it doesn't show because the forum's text editor cuts off extra spaces but that's what I entered in this filename)!!!
    It should definitely be ignored RIGHT?

    WRONG!

    I'm out of words here. Your comments (pretty please)...
    Last edited by tstav; 04-05-2008 at 07:32 AM.
    He didn't know it was impossible, so he did it. (Jean Cocteau)

Posting Permissions

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