Syntax

expression.LookIn

expression A variable that represents a FileSearch object.

Example
This example searches the My Documents folders for all files that begin with "Cmd" and displays the name and location of each file that's found.

Visual Basic for Applications
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