FileName Property
Some of the content in this topic may not be applicable to some languages.
Assistant object: Returns or sets the path and file name for the active Office Assistant. Read/write String.
FileSearch object: Returns or sets the name of the file to look for during a file search. The name of the file may include the * (asterisk) or ? (question mark) wildcards. Use the question mark wildcard to match any single character. For example, type gr?y to match both "gray" and "grey." Use the asterisk wildcard to match any number of characters. For example, type *.txt to find all files that have the .TXT extension. Read/write String.
expression.FileName
*expression * Required. An expression that returns one of the objects in the Applies To list.
Example
This example searches for all files located in the My Documents folder that begin with "cmd" and have a file name extension. The example displays the name and location of each found file.
Set fs = Application.FileSearch
With fs
.LookIn = "C:\My Documents"
.FileName = "cmd*.*"
If .Execute > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With
Applies to | Assistant Object | FileSearch Object
See Also | Animation Property | Overview of the Office Assistant | Using the Office Assistant