Retrieving "Custom Properties" MetaData from Word Documents

J

jamiedora

Hello,

I was wondering if anyone could help. I am trying to retrieve metadata

from a series of word documents. I wish to tag each document's meta
data with custom properties (Name, Value, Type).


I am able to retireve summary info. such as "Author", but when I try to

access ther properties using the "sld2" variable I get the empty
string. Here is my code:


Public Sub RetrieveMetaData()
Dim sId
Dim sld2
Dim objShell
Dim objFolder
Dim objItem As Object
Dim DocProp
Dim strPath As Variant
Dim objFolderItem
Dim objword As Word.Application
Dim WordDocument As Word.Document
Dim objTree As TreeView
Dim objTargetNode As Node
Dim X As Variant


Set objTree = Me.xTree.Object
Set objShell = CreateObject("Shell.Application")


sId = "{F29F85E0-4FF9-1068-AB91-08002B27B3D9}" 'Summary information
property set. Defined in Ntquery.h.
sld2 = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"


Title = "2"
Subject = "3"
sAuthor = "4"
Comments = "6"


X="?????????"


strDocument = "Test.doc"
strPath = "C:\"
Set objFolder = objShell.NameSpace(strPath)
Set objFolderItem = objFolder.ParseName(strDocument)
strDocumentInfo = objFolderItem.ExtendedProperty(sId & Comments)
strCustomInfo= objFolderItem.ExtendedProperty(sld2& X)


End Sub
 
J

Jonathan West

Shell.Application can only retrieve built-in properties. It can't retrieve
custom properties. For that you need to do one of three things.

1. Open the file in Word and use the CustomDocumentProperties collection.

2. Use DSOFILE.DLL to open the file and retrieve custom properties

3. Read the properties directly using C++
http://support.microsoft.com/kb/186898/EN-US/

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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