+ Reply to Thread
Results 1 to 5 of 5

Locate a File within a Directory's Folders

  1. #1
    Registered User
    Join Date
    02-15-2006
    Posts
    93
    Carrying on with the same theme, what if I wanted to get the name of a folder where a specific file is located. I.e. The user picks one of the files and then it gives just the name, not the path.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    I don't know the theme you're referring to, but you could write code around Application.FileSearch. There are good examples in Help.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello toocold,

    Here is macro that will find a file among the folders in the parent directory and return the name of folder the file is in.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Nice code, Leith.

    It doesn't seem to search lower then one level below the current directory. Modify it to do so?

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello SHG,

    Thanks. I'll work on a recursion routine to search all subfolders within a given directory for a file. It would be a good tool have. Thanks for the suggestion.

    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1