Consulting

Results 1 to 4 of 4

Thread: VBA - Search explorer for keyword and return file path

  1. #1

    VBA - Search explorer for keyword and return file path

    Hello,

    I have a column full of values and a folder containing nested subfolders and thousands of files inside, some of them named exactly as the values in the column.
    I would like to search the folder with shell - windows explorer for a value in range and return the resulting file's path in a variable.
    I tried accomplishing this by searching through all files in the folder with fso and with dir - fso worked very slow and with dir I did not manage to search through all subfolders. I'm thinking a windows explorer search inside the main folder for the value might work faster, but nothing I tried worked so far.
    For more background info... all files in folder and subfolders are .jpg and I'd use the filepaths resulted from the search to insert the jpg files next to their respective values
    Is there any way to return the filepath? Any help would be very appreciated!
    Thank you!

  2. #2
    VBAX Mentor
    Joined
    Nov 2022
    Location
    The Great Land
    Posts
    337
    Location
    How to attach file: Reading and Posting Messages (vbaexpress.com), click Go Advanced below post edit window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Great code, works perfectly and very fast, thanks a lot!!

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    Welcome to VBAX mikejo. Thank you for marking your thread as Solved as well.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

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