PDA

View Full Version : Application.FileSearch.TextOrProperty questions



malik641
10-12-2006, 11:24 AM
From the help files:


Returns or sets the word or phrase to be searched for, in either the body of a file or the file's properties, during the file search. The word or phrase can include the * (asterisk) or ? (question mark) wildcard character. Read/write String.

Now what I want to know is....which file properties is this talking about? Author? Title? Keywords?? It doesn't specify.

EDIT: The properties portion actually are the "Keyword", "Title", custom properties, etc....but for MSO files...not for other files, though.

I'm asking this because I want to know if the .FileSearch method can find files other than MSO files that have specific text in them...which it did find a txt file with the word I set in the TextOrProperty property (is that considered an MSO file?). This could be quite useful for me if I could figure a way to use this for files other than MSO files (like AutoCAD .dwg and CorelDraw .cdr files).

Any ideas?

Thanks :thumb

Charlize
10-17-2006, 06:17 AM
A little tryout to see which things are kept in a file and where you can search for. Put this code in module and run 'read_file_info'. It seems its not possible to search on everything 'no keywords, ..' but some info is searchable for every file (even non mso).
Option Explicit
Public Function SetSummaryInfo()
Dim arrHeaders(50)
Dim objShell, objFolder, i, strFileName
Dim startrow As Long
Dim startcolumnheader As Long
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\Data")
startrow = 2
startcolumnheader = 1
For i = 0 To 50
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
Cells(1, startcolumnheader).Value = arrHeaders(i)
startcolumnheader = startcolumnheader + 1
Next
For Each strFileName In objFolder.Items
startcolumnheader = 1
For i = 0 To 50
Cells(startrow, startcolumnheader).Value = i & "-" & _
arrHeaders(i) & ": " & objFolder.GetDetailsOf(strFileName, i)
startcolumnheader = startcolumnheader + 1
Next
startrow = startrow + 1
Next
Columns("a:az").Columns.AutoFit
End Function
Sub read_file_info()
SetSummaryInfo
End Sub

Charlize

Charlize
10-23-2006, 01:29 PM
I have found a way to activate an instance of windows explorer (thanks to Ivan M.). My goal was to be able to give a searchvalue. With this you can search on keywords in any file in a specified directory. Is it this what you're looking for ?

Charlize