dsofile.dll not working on all files?

S

Stefan Goerres

Hello everybody!

I used some code for extraction of the doc Properties. It is working great
for some documents and on the other hand it does not work for a bunch of
others.
When I check in the file with Word I find the properties all set but I can't
read them with dsofile.dll :(
Is there any idea? Can I fix this? It's for some hundred documents so if
there is a macro way ;)

Thanks a lot
Stefan
 
J

Jonathan West

Hi stefan

Which properties aren't working?

Are the offending files password-protected?

What is the file type of the offending files?

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
 
S

Stefan Goerres

the majority are word documents with some word templates in between.
No there ist no password protection.
Some what can I do to get it working?

S.
 
J

Jonathan West

Which properties aren't working? In what way doesn't it work? I'm limited in
the help I can give until you provide a more specific description of the
problem.

Can you show us the relevant part of your code, and describe which line
fails and what the error message is?

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
 
S

Stefan Goerres

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
 
J

Jonathan West

Stefan Goerres said:
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"

Ah! That helps!

What is happening is that, although the file being read presumably has a
..doc extension, it isn't actually a Word format file. It might be an rtf
file with a doc extension, or possibly a Word 2 for Windows file (which had
a different format) or a Word for DOS file or something completely
different. Or possibly it has been corrupted in some way that means that
dsofile can't read it properly.


--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
 
S

Stefan Goerres

Jonathan said:
Ah! That helps!

What is happening is that, although the file being read presumably
has a .doc extension, it isn't actually a Word format file. It might
be an rtf file with a doc extension, or possibly a Word 2 for Windows
file (which had a different format) or a Word for DOS file or
something completely different. Or possibly it has been corrupted in
some way that means that dsofile can't read it properly.

Hmmm, these are Word Documents. And they are created with Word 97,2000 or
XP.
How can I check if this is an rtf file with doc extension or a diffrent
format?
If I open a file in word it is loading fine and all properties are set.
Can I recover the files if they are corupted?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top