# Off Topic > Tips and Tutorials >  >  TIP: fully functioning class emulating depreciated FileSearch object

## OllieB

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!

----------


## arlu1201

Thank you for posting this.

----------


## OllieB

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.

----------


## chrisix1

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"

----------


## juli20008

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.

----------

