Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: FoxPro FAQ

Tips -N- Tricks

How can I perform a file search if I can't distribute Filer.dll? by foxdev
Posted: 18 Jul 00

Microsoft's licensing for Visual FoxPro states that FILER.DLL cannot be distributed with the VFP runtime.  It's a shame, because FILER.DLL provides some file search capabilities that are very easy to use.

But all is not lost.  If your clients have any of the Microsoft Office applications (Word or Excel, for example), you can tap into the FileSearch object common to the Microsoft Office applications.

The code below demonstrates how to do this:

* -- demonstrates a file search using the Microsoft Office FileSearch class

* -- these defines are from the Object Browser in the VB editor
#define  msoConditionAnytimeBetween  26

#define  msoConnectorAnd             1
#define  msoConnectorOr              2

#define  msoSortbyFileName           1
#define  msoSortbySize               2
#define  msoSortbyFileType           3
#define  msoSortbyLastModified       4


lParameters tcFileSpec, tcStartingDir

if (not type('tcFileSpec') = "C")
return .F.

if (not type('tcStartingDir') = "C")
tcStartingDir = curdir()

* -- IMPORTANT: any of the Microsoft Office applications will suffice, as they
* --     all share the same FileSearch feature; I use Word here
oWord = createobject("Word.Application")   && instantiate Word object

With oWord.FileSearch

.NewSearch   && clears last results

.LookIn = tcStartingDir
.FileName = tcFileSpec
.SearchSubFolders = .T.

* -- normally, of course, these params would be passed
* -- I just threw this in to show this feature
.PropertyTests.Add("Last Modified", msoConditionAnytimeBetween, ;
        "07/01/2000", "07/10/2000", msoConnectorAnd)

lnNumFiles = .Execute(msoSortbyFileName)

* -- the .FoundFiles collection now contains a list of found files
* -- .FoundFiles(1) yields the first file name, etc.

for each cFileName in .FoundFiles

* -- obviously, you'd do something a bit more practical
* --    than just listing them

? cFileName



release oWord

Back to Microsoft: FoxPro FAQ Index
Back to Microsoft: FoxPro Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close