+ Reply to Thread
Results 1 to 2 of 2

Find *.xls files in a directory and run macro(including *.xls located in subfolders)

  1. #1
    Registered User
    Join Date
    11-20-2012
    Location
    World
    MS-Off Ver
    Excel 2003
    Posts
    2

    Find *.xls files in a directory and run macro(including *.xls located in subfolders)

    Hi All,

    I have been able to use code from the following discussion,LINK, to loop through a folder and run a macro on all matching files in that folder, one by one.

    I have a file structure that looks like this (and I cannot adjust it):

    PARENT FOLDER
    -Folder 1
    -FILE1.XLSX
    -Folder 2
    -FILE2.XLSX
    .
    .
    .
    -Folder N
    -FileN.XLSX
    I'd like to either use that existing code to also look in subfolders for matching files and run the marco on those too. I found code in my search that used a deprecated Filesearch function, but in Excel2010 it won't work.

    The macro I run ends up exporting data to subfolders within the activeworkbook's directory which is why I cannot change the file structure. I imagine there's an easier way compared to the code I've been currently trying (works well, has some bells & whistles though).

    I would greatly appreciate any help.

    Best,
    DL

  2. #2
    Registered User
    Join Date
    11-20-2012
    Location
    World
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Find *.xls files in a directory and run macro(including *.xls located in subfolders)

    As an update, I was able to debug print the correct files I want to execute the macro on using this code (from here: Link

    Please Login or Register  to view this content.
    While the debug print finds the right files, when I call the MACRO, every variable that I have in the macro yields a "Variable Undefined Error" ...

+ 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