+ Reply to Thread
Results 1 to 5 of 5

Search and Copy from file list within subfolders to one destination folder VBA Script

  1. #1
    Registered User
    Join Date
    09-15-2016
    Location
    CANADA
    MS-Off Ver
    2007
    Posts
    3

    Search and Copy from file list within subfolders to one destination folder VBA Script

    Exclamation
    After hours of searching I am totally exhausted....hopefully I articulate my situation for some assistance.
    Looking for a VBA code to do the following...found lots of examples that address a couple of aspects of what I am trying to accomplish, however cannot tie them all together...ok lets go lol

    I have a list of file names in column A 123.pdf or 123.xls So on and so forth (it doesnt matter)

    I would like the code to search a number of sub folders off the root folder for those files (in column A) and when found copy them to a folder I designate

    I found this code i altered that works perfect however only works at the root and does not search within the sub folders...

    Please Login or Register  to view this content.
    [/COLOR]

    I surrender...please someone out there help me out with this...I am sure it is something simple and hope that I explained my predicament.
    Vicco
    Last edited by alansidman; 10-19-2016 at 05:17 PM. Reason: code tags added

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2403 Win 11 Home 64 Bit
    Posts
    23,810

    Re: Search and Copy from file list within subfolders to one destination folder VBA Script

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    09-15-2016
    Location
    CANADA
    MS-Off Ver
    2007
    Posts
    3

    Re: Search and Copy from file list within subfolders to one destination folder VBA Script

    Thank you alansidman....i will comply moving forward...i am not a big form guy..google has been my friend for years and i am totally stuck
    cheers

  4. #4
    Registered User
    Join Date
    09-15-2016
    Location
    CANADA
    MS-Off Ver
    2007
    Posts
    3

    Re: Search and Copy from file list within subfolders to one destination folder VBA Script

    is there anyone out there who may be able to help

  5. #5
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Search and ________ within subfolders to one destination folder VBA Script

    Hi VICCO12,
    Quote Originally Posted by VICCO12 View Post
    is there anyone out there who may be able to help
    I expect there probably is, If you can explain well enough so that someone seeing your requirement for the first time can understand .
    You have tried very well to explain, but remember you know the project inside and out, so you would understand almost any explanation.
    But you must make it crystal clear to someone encountering it for the first time and so not familiar with it
    _.........................................................................................

    Anyway...
    Welcome to the Excel Forum.
    ( from a real person .... – this
    http://www.excelforum.com/showthread...t=#post4505430
    Was just Computer generated !!
    ( I do not know the history behind arlu1201 )

    At first glance your requirement sounds like a requirement that is often fulfilled using a recursion Subroutine that searches through each Sub Folder and its Files in a Folder. Such a code “Calls itself”. That is to say as long as there are more Sub Folders, a copy of the Subroutine is made and started which goes “down a level” doing the same until there are no more “lower down” levels.
    If you have not heard of such recursion techniques and are not familiar with them then you will do your head in trying to figure out how to do what you are trying to do.
    Like everything it is easy once you know how.

    _..___

    I suggest if you want help here with this you
    _1 ) Please take some time to read the Forum Rules here
    http://www.excelforum.com/forum-rule...rum-rules.html
    http://www.excelforum.com/forums-rules/
    http://www.excelforum.com/showthread...09#post4494031

    _ 2) See if you can glean any information from these Posts and the various other posts and codes referenced therein.
    http://www.excelforum.com/excel-prog...ml#post4492930
    http://www.excelforum.com/excel-prog...ml#post4332852
    http://www.excelforum.com/showthread.php?t=1149000

    _ 3) After getting even more confused after reading those posts, try to explain again carefully exactly what it is you want to do. Give a small number of representative File names / Folder names etc.. Paste your codes again properly using code tags so that indents etc. are maintained. Follow all the info here
    http://www.excelforum.com/showthread...09#post4494031
    and practice posting properly if you are not sure of anything.

    _....
    If you do all that and are still not able to get further then I will take a look at it for you in the next day or so. I am not yet 100% clear from your explanations, but it sounds like something similar to what I did in those other Threads. The difficulty is less of what you are actually wanting finally to do.
    You need just to get the hang of the recursion code ideas to do something at all Folders and subFolders
    The crutch of what you are doing is
    Searching and ________ in / for all Files in SubFolders
    The ________ is not usually the problem, the
    Going through ( Looping through ) all Files in SubFolders
    Is where the work is, and what you need to master, and it is probably very wise to master that first. It comes up time and time again and you may want to go through all Files in SubFolders sometime in the Future..
    Alan

    P.s. as you are Google man, like me_... ( I hate google spying on me – but it does it so well it seems to know what I want and I find almost everything I want with it ):::_...
    My start point was this:
    http://excelpoweruser.blogspot.de/20...-files-in.html
    I then modified that code so as to replace the simple List it produced with a more Explorer type output going “down” the levels across to the right like for example posts
    From here
    http://www.excelforum.com/showthread...00#post4440551
    To here
    http://www.excelforum.com/showthread...00#post4440552
    Last edited by Doc.AElstein; 10-22-2016 at 04:30 AM.
    '_- Google first, like this _ site:ExcelForum.com Gamut
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE
    http://www.excelforum.com/the-water-...ml#post4109080
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/ ( Scrolll down to bottom )

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 10-19-2016, 04:44 PM
  2. Replies: 0
    Last Post: 04-21-2014, 04:03 PM
  3. [SOLVED] Macro to create hyperlink list of every file in a folder, subfolders
    By itmanusa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-25-2013, 12:43 PM
  4. Macro to create hyperlink list of every file in a folder, subfolders, and SHORTCUTS
    By Billdick7788 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-20-2013, 11:11 AM
  5. how to search a file in folder and subfolders
    By rakeshredround in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-05-2012, 03:35 AM
  6. Macro to search folder including subfolders for file and open
    By kiraexiled in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-01-2012, 02:45 PM
  7. Replies: 2
    Last Post: 03-26-2012, 07:12 PM

Tags for this Thread

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