Working With Other Workbooks And Files

Exir a

You can use different optional properties with the FileSearch object to search for specific file on a system. The following table lists the most useful properties.

FILESEARCH PROPERTY

DESCRIPTION

FileName

Indicates the name of the file to locate during the file search. This value can be a specific filename or contain the wildcard symbols * and ?.

FileType

A MsoFileType constant value indicating the type of files to look for during the file search. See Appendix A for the available MsoFileType constant values.

FoundFiles

Returns a FoundFiles object containing the names of the file matches.

LastModified

A MsoLastModified constant value indicating the amount of time since file was last modified. See Appendix A for the MsoLastModified constant values.

LookIn

Indicates the folder to search.

MatchTextExactly

Boolean value used with TextOrProperty property to indicate if only files containing specified text should be returned.

SearchSubFolders

Boolean value indicating whether the subfolders of the folder specified by the .LookIn property should also be searched.

TextOrProperty

A string that sets the word or phrase to search for in the body of the file or the file's properties. The string can include the * and ? wildcard symbols.

Vba Form Many Excel Files Show

, Type Pathlnfo = FoundFiles(i).

■ If Excel finds the specified file it is opened.

, Type Pathlnfo = FoundFiles(i).

—— Type additional VBA code to execute for each file match.

—E Type Workbooks.Open Filename:=PathInfo.

■ If Excel finds the specified file it is opened.

0 0

Post a comment