Search Files

N

Noga Stevens

When I try to search a directory for all files, It returns
only the .doc files. The advance search is set to All
Files.

I have tried using the example below but my computer
doesn't recognize "msoFileTypeAllFiles".


Dim objFS As Object

Set objFS = Application.FileSearch

With objFS

' Resets all the search criteria settings to
their default
' settings.
.NewSearch

' Where to search in Windows 95. For Windows
NT 4.0, change
' the path to "C:\Winnt\System32\".
.LookIn = "C:\"

' This will limit the search.
.FileType = msoFileTypeAllFiles

.FileName = "*.SYS"

' Search for "WinDir" within a file. This
string is present
' in the file, MSDOS.SYS, in Windows 95. For
Windows NT 4.0,
' change to "Invalid."
.TextOrProperty = "WinDir"

' Limit the search to the root.
.SearchSubFolders = False

' Begin the search.
.Execute
End With

' Show the number of files found.
MsgBox "Files found = " & objFS.FoundFiles.Count
 
E

Emilia Maxim

Noga Stevens said:
When I try to search a directory for all files, It returns
only the .doc files. The advance search is set to All
Files.

I have tried using the example below but my computer
doesn't recognize "msoFileTypeAllFiles".

Noga,

set a reference to the Microsoft Office Object Library. All items
called msoXXX are items from the Office object library.

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top