全部显示

FileType 属性

       

返回或设置文件查找过程中要搜索的文件类型。 MsoFileType 类型,可读写。

expression.FileType

expression   必需。该表达式返回“应用于”列表中的对象之一。

说明

常量 msoFileTypeOfficeFiles 包含以下任意扩展名的文件:*.doc、*.xls、*.ppt、*.pps、* obd、*.mdb、*.mpd、*.dot、*.xlt、*.pot、*.obt、*.htm 或 *.html。

示例

本示例可实现的功能为:搜索位于“My Documents”文件夹中的所有“活页夹”文件,然后在消息框中显示找到的每个文件的文件名及其所在位置。

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