FileType Property

Applies To

FileFind object, FileSearch object.

Description

FileSearch object: Returns or sets the type of file to be searched for during a file search. Can be one of the following MsoFileType constants: msoFileTypeAllFiles, msoFileTypeBinders, msoFileTypeDatabases, msoFileTypeExcelWorkbooks, msoFileTypeOfficeFiles, msoFileTypePowerPointPresentations, msoFileTypeTemplates, or msoFileTypeWordDocuments. The default value is msoFileTypeOfficeFiles. Read/write Variant.

FileFind object: Returns or sets the type of file to be searched for. Can be set to a number returned by the MacID function. Macintosh only. Read/write Long.

Remarks

Use the arguments listed in the following table with the MacID function to return the appropriate Macintosh file type.

File type

Argument

Word document

MSWD

Microsoft Excel workbook

XCEL

PowerPoint presentation

PPT3 (for use with all versions of PowerPoint)

Text file

TTXT


See Also

Execute method, NewSearch method.

Example

This example searches for all Binder files located in the My Documents folder. The example displays the name and location of each found file in a message dialog.

Set fs = Application.FileSearch
With fs
    .LookIn = "C:\My Documents"
    .FileType = msoFileTypeBinders
    If .Execute > 0 Then
        MsgBox "There were " & .FoundFiles.Count & _
            " Binder file(s) found."
        For i = 1 To .FoundFiles.Count
            MsgBox .FoundFiles(i)
        Next i
    Else
        MsgBox "There were no Binder files found."
    End If
End With