Consulting

Results 1 to 2 of 2

Thread: Solved: FileSearch

  1. #1
    VBAX Regular
    Joined
    Jul 2011
    Posts
    33
    Location

    Solved: FileSearch

    Hello, I'm having a problem using the FileSearch property. I get an error message on the third line of the following code which says that the object doesn't admit the property. I took the code from a post I read. Any idea how can I solve this problem? Thanks in advance.


    [vba]Sub openAllfilesInALocation()
    Dim i As Integer, wb As Workbook
    With Application.FileSearch
    .NewSearch
    .LookIn = "C:\Documents and Settings\jmortsev\Mis documentos\Proyectos\Michael Lacroix"
    .SearchSubFolders = False
    .Filename = "*.xls"
    .Execute
    For i = 1 To .FoundFiles.Count
    Set wb = Workbooks.Open(Filename:=.FoundFiles(i))
    wbResults.Close SaveChanges:=False
    Next i
    End With
    End Sub
    [/vba]

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Filesearch has been deprecated in xl 2007 up.
    Explore fileSystemObject perhaps.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •