Results 1 to 7 of 7

Excel 2007 : Read files in folder, code is ok for 2003 not for 2007

Threaded View

  1. #1
    Registered User
    Join Date
    03-15-2009
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2003
    Posts
    37

    Read files in folder, code is ok for 2003 not for 2007

    This code works in Excel 2003 but when I run it in 2007 it hangs on "Set FileS..." The error says wrong method.

    Any help would be greatly appreciated!


    '020 Read & build list of all *XLS files including subfolders (optionally)
     Dim FileS As FileSearch
     Dim F As Variant
     Dim x As Integer
     Set FileS = Application.FileSearch
       With FileS
          .NewSearch
          .Filename = "*.xls" 'hardwired to look for only excel
          .LookIn = Cells(30, 4)
          .SearchSubFolders = False
          .Execute
       End With
     C13 = 1
       For Each F In Application.FileSearch.FoundFiles
          Cells(C13, 25) = F: C13 = C13 + 1
       Next F
    Last edited by MrHockey; 03-31-2009 at 08:30 PM.

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