DSO Summary Properties Error

J

John Michl

I use a small chunk of VBA to allow me to edit summary properties via
an Excel sheet. Basically, one macro retrieves a list of file names
from a folder, then list those names and various properties in a sheet
(properties include Title, Author, Subject, Category, etc.)

I have a second macro that changes the values of those properties if
they've been edited in the Excel file. Occasionally, I run into a
permission error when trying to update certain properties. It seems to
be localized to situations where the property's previous value was null
and I'm trying to change that value. If I use Windows Explorer to
change the value and then try to edit via my macro, it will work fine.

For some fields, like Title, I can remove a value and then use the
macro to add one without a problem. With other fields, like Category,
I'll get the error anytime I try to update it from null to something.

Any guidance would be appreciated. I've searched high and low and
can't seem to figure out what is happening.

- John
 
J

John Michl

Still having problems but here's a little more information. I've only
been able to create the problem on DOC files, XLS seem to update fine.
Also, I can update most properties but receive the permission denied
error if attempting to update Category, Manager or Company. I have two
sample Word DOCs created by right-clicking in Windows Explorer. No data
inside the files. One creates there errors. The other doesn't. I've
tried closing Windows Explorer to ensure that nothing is trying to
access the file. In addition, I've commented out the props mentioned
above and the code works fine...every time.

Any help would be appreciated.

Here's my code. It crashes at the .Category

Sub TestDSO()

Dim DSO As DSOFile.OleDocumentProperties
Set DSO = New DSOFile.OleDocumentProperties
strFile = "C:\Documents and Settings\mic06\My
Documents\TestFolder\Test1\ProblemFile.doc"
DSO.Open sfilename:=strFile

With DSO.SummaryProperties
.Title = "This is the Title"
.Subject = "This is the Subject"
.Category = "This is the Category"
End With

DSO.Save
DSO.Close
End Sub
 

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