+ Reply to Thread
Results 1 to 6 of 6

Processing xls files sequentially

  1. #1
    Registered User
    Join Date
    06-18-2009
    Location
    australia
    MS-Off Ver
    excel 2007
    Posts
    7

    Processing xls files sequentially

    Gday all,

    I use Excel 2003 at work, and 2007 at home. The wife is crook today, so im working from home... well, trying to. I have searched the net for a solution to my particular prob, but while I am ok with developing and running some macro's, im not really a power user.

    Problem:
    I understand that Application.FileSearch has been depreciated in 2007, but I cannot seem to modify other suggested codes to make workarounds work with my needs. Im hoping someone here can help

    I have a folder with a many .xls files in it, all ending in "*metrics33yrs.xls", my 2003 code (sourced from the net) opens each one sequentially (1st part of below code), copies given cells, and pastes them into a separate workbook (2nd part of below code).

    Can anyone please help with the first part of the code so that it works in 2007?

    Cheers in advance

    Please Login or Register  to view this content.
    Last edited by Bjornago; 06-18-2009 at 08:39 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    re: Processing xls files sequentially

    Welcome to the forum, Bjornago.

    Please take a few minutes to read the forum rules, and then edit your post to add code tags.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Processing xls files sequentially

    Thanks.

    FileSearch isn't deprecated in 2007, it's gone. Puzzling.

    This isn't fully cooked yet, but let me know how you get on.

    Please Login or Register  to view this content.
    It REQUIRES a reference to Microsoft Scripting Runtime.

    Please Login or Register  to view this content.
    will return a variant that is either Empty or contains a list of found files.

  4. #4
    Registered User
    Join Date
    06-18-2009
    Location
    australia
    MS-Off Ver
    excel 2007
    Posts
    7

    Re: Processing xls files sequentially

    I have just found a code by RoyUK which seems to fit the bill...

    However... when i run the code, and it reaches the Do While sFil <> "", it skips straight to the end loop. I have stipulated the right directory, and have changed the file format (sFil = Dir("*.xlsx")) to .xls to match the 2003 files i have, so am at a loss why this isn't working...

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-18-2009
    Location
    australia
    MS-Off Ver
    excel 2007
    Posts
    7

    Re: Processing xls files sequentially

    Cheers shg, muchly appreciate your time and effort, but using functions is out of my league, haven't mucked around with them before...

    I've referenced the scripting runtime, but am unsure how to use your code from there...

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Processing xls files sequentially

    Like this:
    Please Login or Register  to view this content.
    Last edited by shg; 06-19-2009 at 07:07 PM.

+ 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