Results 1 to 3 of 3

Loop Thru Wkbks in folder and subfolders

Threaded View

  1. #1
    Registered User
    Join Date
    08-05-2009
    Location
    Wales UK
    MS-Off Ver
    Excel 2003
    Posts
    26

    Loop Thru Wkbks in folder and subfolders

    Hi everyone,

    Debra Dalgleish's Contextures site has a neat bit of code that loops through workbooks in a folder.

    Sub AllFolderFiles() 
    Dim wb As Workbook 
    Dim TheFile As String 
    Dim MyPath As String 
    MyPath = "C:\Temp" 
    ChDir MyPath 
    TheFile = Dir("*.xls") 
    Do While TheFile <> "" 
      Set wb = Workbooks.Open(MyPath & "\" & TheFile)              
      MsgBox wb.FullName 
      wb.Close 
      TheFile = Dir 
    Loop 
    End Sub



    What I wanted to do, if possible, is also get it to loop through the subfolders too.

    If anyone could help that would be great.

    Cheers
    Diddy
    Last edited by Diddy; 09-16-2010 at 07:42 AM. Reason: Forgot to add code

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