VBA code to search files

  • Hi all,


    I am quite new to VBA and just started using it. I am finding it very hard to get hold of the file handling concepts. Please help.


    I want to search for a file inside a directory which contains many folders and sub-folders. The file that i am looking for is inside any of those folders of sub-folders. I would like to enter the file name in a msgbox or at a specific cell in a work book so that the file is searched and saved at the destination foler that i specify.


    Note: the file i am looking for is not always excel workbooks. Most of them are data files which contains text in .csv format.


    Thanks

  • Re: VBA code to search files


    Thank you very much Jindon.


    The code works perfect to get the path of the file that i am looking for. Now, I will try to improvise to copy and paste the searched file to my destination folder.


    Cheers

  • Re: VBA code to search files


    Try this,

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!