Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search for file, using properties 'Title'

Status
Not open for further replies.

Firery

Technical User
Sep 23, 2003
18
AU
Thanks for even looking,

I'm trying to write a code in VBA (Excel) to search for a file with a specific value in it's builtindocumentproperties "Title".

With Filesearch, I can search using 'TextOrProperties',
but I only want to find a file with a specific property (title).

Hope someone can help.

 
How about:

Code:
Set fs = Application.FileSearch
strLookIn = "C:\Docs\"
With fs
    .NewSearch
    .FileName = "*.xls"
    .LookIn = strLookIn
    .SearchSubFolders = False
    .PropertyTests.Add "Title", msoConditionIncludes, "ThisText"
    If .Execute > 0 Then
        For Each varFile In .FoundFiles
            Debug.Print varFile
        Next varFile
    End If
End With

--
 
Thankyou REMOU

Works perfectly

I hope my knowledge attains a level where I can help others too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top