+ Reply to Thread
Results 1 to 7 of 7

Create auto updating list of folder contents

  1. #1
    Registered User
    Join Date
    03-13-2008
    Posts
    87

    Create auto updating list of folder contents

    Hello there,

    I am working on Excel 2008 for Mac. I am wanting to create a macro that will automatically pull in folder contents and continuously update whenever I open the file.

    I've successfully done this with Word on PC in the past, but that was a really long time ago. So I don't remember.

    Any ideas?

    Thanks,
    Lorne

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Create auto updating list of folder contents

    Excel 2008 for the Mac doesn't support VBA I'm afraid.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    03-13-2008
    Posts
    87

    Re: Create auto updating list of folder contents

    Well shoot.

    How might I do this on PC?

    Thanks,
    lorne

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Create auto updating list of folder contents

    Something like this:

    Please Login or Register  to view this content.

    Which could then be called from a workbook open event:

    Please Login or Register  to view this content.

    The first bit of code should go in a regular module and the second on the ThisWorkbook code page.

    Dom

  5. #5
    Registered User
    Join Date
    03-13-2008
    Posts
    87

    Re: Create auto updating list of folder contents

    Awesome, thank you. I'll take a stab at it when I get on my PC.

    Lorne

  6. #6
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Create auto updating list of folder contents

    Oops. I walked away from my PC and a whole conversation took place before I hit "submit". Oh well. Here is my code.

    Please Login or Register  to view this content.

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,998

    Re: Create auto updating list of folder contents

    This should work in XL2008 since it uses the old FILES XLM function. As with all XLM functions, you cannot use it directly in a worksheet cell - you have to use it in a defined name and then use that name in the cell.

    So, to set up the name:

    In 2003 or earlier:
    Select Insert - Name - Define from the menu, enter FileList in the 'Names in workbook:' box, then in the 'Refers to:' box enter:
    =FILES(Sheet1!$A$1)
    then press OK.

    This name will now use the contents of A1 on Sheet1 as the path and name to use for the file list. So, for example, you can enter:
    C:\Test\*.*
    in A1 to return a list of all files in C:\test, or:
    C:\Test\*.xls
    to return a list of workbooks in that folder.

    To use this in the worksheet, enter:
    =INDEX(FileList, row())
    in B1 and copy down. The ROW() function will return 1,2,3,4 etc as you copy down so that the value returned in the cells is the 1st then 2nd then 3rd item in the FileList array.
    Everyone who confuses correlation and causation ends up dead.

+ 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