the code looks like this and is from listprops.dot example. I only added
the error handling to see what ist going on. The error I get is "The File %1
is not a valid compound file"
When I debug the session I get a Run-Time error 800300fb -> "Method
'GetDocumentProperties' of object '_PropertyReader' failed"
With Application.FileSearch
.NewSearch
.FileType = msoFileTypeOfficeFiles
.LookIn = ChosenFolder.Caption
.SearchSubFolders = chkSubfolders.Value
.Execute
iTotalFiles = .FoundFiles.Count
MsgBox (iTotalFiles)
On Error Resume Next
For iFileIndex = 1 To iTotalFiles
StatusBar = "Processing file " & iFileIndex & " of " & iTotalFiles
If Not FileLocked(WordBasic.FileNameInfo$(.FoundFiles(iFileIndex),
1)) Then
Set oDocProp = oFilePropReader.GetDocumentProperties( _
WordBasic.FileNameInfo$(.FoundFiles(iFileIndex), 1))
If Err.Number = 0 Then
Debug.Print "OK :"; iFileIndex &
WordBasic.FileNameInfo$(.FoundFiles(iFileIndex), 1)
DoEvents
For iPropIndex = 0 To SelectedProps.ListCount - 1
Select Case SelectedProps.List(iPropIndex)
Case "Application name"
strPropText = oDocProp.AppName
Case "Author"
strPropText = oDocProp.Author
Case "Category"
strPropText = oDocProp.Category
Case "CLSID"
strPropText = oDocProp.CLSID
Case "Comments"
strPropText = oDocProp.Comments
Case "Company"
strPropText = oDocProp.Company
Case "Creation date"
strPropText = oDocProp.DateCreated
Case "File name"
strPropText = oDocProp.Name
Case "File name (including path)"
strPropText = oDocProp.Location & oDocProp.Name
Case "Keywords"
strPropText = oDocProp.Keywords
Case "Last author"
strPropText = oDocProp.LastEditedBy
Case "Last print date"
strPropText = oDocProp.DateLastPrinted
Case "Last save time"
strPropText = oDocProp.DateLastSaved
Case "Macros"
strPropText = oDocProp.HasMacros
Case "Manager"
strPropText = oDocProp.Manager
Case "Number of bytes"
strPropText = oDocProp.ByteCount
Case "Number of characters"
strPropText = oDocProp.CharacterCount
Case "Number of characters (with spaces)"
strPropText = oDocProp.CharacterCountWithSpaces
Case "Number of hidden slides"
strPropText = oDocProp.HiddenSlides
Case "Number of lines"
strPropText = oDocProp.LineCount
Case "Number of multimedia clips"
strPropText = oDocProp.MultimediaClips
Case "Number of notes in a presentation"
strPropText = oDocProp.PresentationNotes
Case "Number of pages"
strPropText = oDocProp.PageCount
Case "Number of paragraphs"
strPropText = oDocProp.ParagraphCount
Case "Number of slides"
strPropText = oDocProp.SlideCount
Case "Number of words"
strPropText = oDocProp.WordCount
Case "Presentation format type"
strPropText = oDocProp.PresentationFormat
Case "ProgID of the parent application"
strPropText = oDocProp.ProgID
Case "Read only"
strPropText = oDocProp.IsReadOnly
Case "Revision number"
strPropText = oDocProp.RevisionNumber
Case "Subject"
strPropText = oDocProp.Subject
Case "Template"
strPropText = oDocProp.Template
Case "Title"
strPropText = oDocProp.Title
Case "Total editing time"
strPropText = oDocProp.TotalEditTime
Case "Version"
strPropText = oDocProp.Version
End Select
If Err.Number <> 0 Then
Err.Clear
strPropText = "<not available>"
End If
MyRange.InsertAfter Text:=strPropText & vbTab
Next iPropIndex
Err.Clear
MyRange.Collapse Direction:=wdCollapseEnd
MyRange.Delete Unit:=wdCharacter, Count:=-1
MyRange.InsertParagraph
Set oDocProp = Nothing
Else
Debug.Print "Err :" & iFileIndex &
WordBasic.FileNameInfo$(.FoundFiles(iFileIndex), 1)
Debug.Print "Err : " & Err.Description
Err.Clear
End If
End If
Next iFileIndex
End With