+ Reply to Thread
Results 1 to 5 of 5

Updating list of all files in a folder

  1. #1
    Registered User
    Join Date
    07-07-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    6

    Updating list of all files in a folder

    Hello,

    I'm not that well versed in VBA so please help!

    I have a MASTER workbook and other TEMPLATE workbooks (Template1, Template2), in the same folder, however, this folder will change dependent on the project I am working on (C:\ProjectA, C:\ProjectB, etc.) and as such I think the code will have to refer to the MASTER workbook current location.

    I need a piece of code that will list all excel files within the folder on Sheet2 of the MASTER workbook and update each time the master workbook is opened.


    Thanks,
    Mark
    Last edited by Mark.jpl; 07-29-2011 at 11:30 AM.

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Updating list of all files in a folder

    Put the following code in the Workbook_Open event of the Master workbook.

    Please Login or Register  to view this content.
    Last edited by davegugg; 07-29-2011 at 10:48 AM.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Registered User
    Join Date
    07-07-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Updating list of all files in a folder

    Thanks for that but all that happens when the Master file is opened is Cell A1 on Sheet2 has "Other workbooks in this directory." and there is no list below it, any ideas?

    I have both .xls and .xlms spreadsheets I need to list, I don't know if that makes a difference?

    Thanks.

  4. #4
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Updating list of all files in a folder

    I've updated the code to include .xlsx and .xlsm.

  5. #5
    Registered User
    Join Date
    07-07-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Updating list of all files in a folder

    Thanks a lot! It works perfectly!

+ 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