LookIn Property

Microsoft Office Object Model

LookIn Property

       

Returns or sets the folder to be searched during the specified file search. Read/write String.

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.

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