+ Reply to Thread
Results 1 to 4 of 4

Ceate a root directory to select multiple files at once.

  1. #1
    Registered User
    Join Date
    12-10-2015
    Location
    Michigan
    MS-Off Ver
    2010
    Posts
    52

    Ceate a root directory to select multiple files at once.

    I currently am writing a code where I take multiple files at once and put some of their data into a master file. Right now my code can take a folder and read what is inside that folder and open any excel file that is in that folder. The issue is, if there is a folder within that folder it will not open that folder to check if there are more files in it. So I need to write a code that can select a root directory and let it run through all folders within the folder selected.
    This is what i currently have
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Ceate a root directory to select multiple files at once.

    Hi B_Jarbs,

    Try the following code which is included in the attached file. The attached file is meant as a control file, from which you can open your master file and all your data files. Instead of an Interactive Folder Picker, I have the Folder Picker in a separate module, that stores the Folder Path in the Control File.

    I see that you are already using 'Option Explicit' which is very important.

    In an ordinary code module:
    Please Login or Register  to view this content.
    Lewis
    Last edited by LJMetzger; 01-12-2016 at 03:53 PM. Reason: Replaced file and code above due to error that may have omitted root

  3. #3
    Registered User
    Join Date
    12-10-2015
    Location
    Michigan
    MS-Off Ver
    2010
    Posts
    52

    Re: Ceate a root directory to select multiple files at once.

    Thanks, this gave some good insight on how the directory works. With this code though, how do I copy certain cells from those open files? I was using something like this
    Please Login or Register  to view this content.
    but that was with the single folder picker. I have 2 different sheets that I am copying from for each file.
    Thanks again for taking the time to look at this.

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Ceate a root directory to select multiple files at once.

    Hi,

    The attached zip file contains files:
    a. ExcelForumProcessFilesInSubFolders2.xls - Updated copy of the previous file that actually processes files and puts results in a destination file.
    b. ExcelForumDestinationFile.xlsx - Simulated destination file.
    c. ExcelForumSourceFile1.xlsx - Simulated source file
    d. ExcelForumSourceFile2.xlsx - Simulated source file with different data

    The following contains code excerpts to demonstrate how the source and destination files are processed:
    Please Login or Register  to view this content.
    Lewis
    Attached Files Attached Files

+ 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. [SOLVED] Import multiple files from same directory
    By anrichards22 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-18-2013, 03:56 AM
  2. [SOLVED] Macro to Import Multiple TXT Files into workbook - User to select files/directory
    By saber007 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-15-2013, 08:43 PM
  3. Select multiple files and save each as a pdf in the same directory
    By test99 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-10-2013, 12:03 PM
  4. Replies: 0
    Last Post: 01-21-2012, 11:48 PM
  5. Replies: 2
    Last Post: 11-03-2011, 02:56 AM
  6. Import table data from .mdb in my web's root directory
    By ern2ern in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-17-2008, 08:48 AM
  7. [SOLVED] Saving to root directory
    By ChrisP in forum Excel General
    Replies: 2
    Last Post: 07-30-2006, 09:15 PM
  8. ms query root directory
    By ecreate in forum Excel General
    Replies: 0
    Last Post: 05-05-2005, 07:43 AM

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