+ Reply to Thread
Results 1 to 5 of 5

TIP: fully functioning class emulating depreciated FileSearch object

  1. #1
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    TIP: fully functioning class emulating depreciated FileSearch object

    Dear all;,

    I just happened to need a file search method that also looks in sub-folders and discovered that the Application.FileSearch capability (that existed in 2003) has been depreciated in Excel 2007. I have therefore written a class object that mimics the old FileSearch capabilities (tried to make an exact copy).

    The full workbook containing the class code as well as an example is attached

    The code to use the class object is also shown below

    Please Login or Register  to view this content.
    It is pretty much a copy of the original Excel solution (or at least close). I have added a Verbose option which you can set to Silent, Errors only or Debug (including informational messages).

    I hope you find this a useful utility and please feel free to copy it /change it etc etc!
    Attached Files Attached Files
    If you like my contribution click the star icon!

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: TIP: fully functioning class emulating depreciated FileSearch object

    Thank you for posting this.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: TIP: fully functioning class emulating depreciated FileSearch object

    A new version is attached which now also includes a ".What" property to specify whether you are interested in a single object (i.e. the search should stop when the/ a object is found), or whether you want to search for all occurrences of the object in question. The latter was the default in the previous version but could result in longer than necessary processing times in case of large folder structures.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    07-04-2013
    Location
    ici
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: TIP: fully functioning class emulating depreciated FileSearch object

    Hello,
    I tried these FileSearch function and needed to complete...
    - add FileType option
    - add Get filename
    - compare filename without case
    - execute() as function
    All corrections were marked with '--cr
    I tried to be most close to excel2003, but didn't remove "verbose" and "what" (not in 2003)

    If someone can complete : I didn't perform sort options for "execute"
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-14-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: TIP: fully functioning class emulating depreciated FileSearch object

    Thank you. This is very helpful. In terms of - execute() as function, I simply replace it with .FoundFiles.Count and make sure also to quote . execute before that line. I hope this would help a little.

+ 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