TechWhirl (TECHWR-L) is a resource for technical writing and technical communications professionals of all experience levels and in all industries to share their experiences and acquire information.
For two decades, technical communicators have turned to TechWhirl to ask and answer questions about the always-changing world of technical communications, such as tools, skills, career paths, methodologies, and emerging industries. The TechWhirl Archives and magazine, created for, by and about technical writers, offer a wealth of knowledge to everyone with an interest in any aspect of technical communications.
RE: Reading Word's Custom Properties without opening a doc?
Subject:RE: Reading Word's Custom Properties without opening a doc? From:"Steve Hudson" <adslyy5g -at- tpg -dot- com -dot- au> To:"TECHWR-L" <techwr-l -at- lists -dot- raycomm -dot- com> Date:Tue, 10 Aug 2004 13:27:44 +1000
That WordBasic command just returns the filepath of the selected document.
It has nothing to do with the command, for example, my ammendment to the MVP
site which also uses the DSOFile looks like this:
Sub GetAllCustProps(ByRef DocumentFullname As String, _
ByRef ALargeEnough2DArray() As Variant, _
ByRef Count As Long)
'Steve Hudson
'Pass it the full path and file name in DocumentFullname
'Dimension your array large enough, for eg Dim MyArray(100,2)
'Count returns the number of entries for that document
'ALargeEnough2DArray(n,1) returns the property name
'ALargeEnough2DArray(n,2) returns the property value
Dim oReader As DSOleFile.PropertyReader
Dim DocProp As DSOleFile.DocumentProperties
Dim CustProp As DSOleFile.CustomProperty
Count = 0
Set oReader = New DSOleFile.PropertyReader
Set DocProp = oReader.GetDocumentProperties(DocumentFullname)
For Each CustProp In DocProp.CustomProperties
Count = Count + 1
With CustProp
ALargeEnough2DArray(Count, 1) = .Name
ALargeEnough2DArray(Count, 2) = .Value
End With
Next
Set CustProp = Nothing
Set DocProp = Nothing
Set oReader = Nothing
End Sub
-----Original Message-----
From: suzy -dot- davis -at- doi -dot- vic -dot- gov -dot- au
Woops, Rob
I forgot to write a response to you.
I know there is an API which does what you want that my colleague was using
last year, allows you to read the custom properties of documents as you loop
through them in explorer using VBA from Word.
I don't think the one he used included WordBasic, and not sure if I kept a
note of it. I think he's currently traipsing around inland Australia...
So if what you have doesn't do it, give me a yell and I'll see if I can find
it for you.
regards
Suzy
"Rob Partridge"
<rob -at- holly -dot- com -dot- au> To:
"TECHWR-L" <techwr-l -at- lists -dot- raycomm -dot- com>
Sent by: cc:
bounce-techwr-l-165345 -at- lists -dot- Subject: RE:
Reading Word's Custom Properties without opening a doc?
raycomm.com
09/08/04 02:10 PM
Please respond to "Rob
Partridge"
Never mind... I may have found my solution. I finally found this on the
web:
Sub GetCProps()
Dim oFilePropReader As DSOleFile.PropertyReader Dim oDocProp As
DSOleFile.DocumentProperties Dim oCustProp As DSOleFile.CustomProperty Dim
sTmp As String
Set oFilePropReader = New DSOleFile.PropertyReader
With Dialogs(wdDialogFileOpen)
If .Display = -1 Then
Set oDocProp = oFilePropReader.GetDocumentProperties( _
WordBasic.FileNameInfo$(.Name, 1))
For Each oCustProp In oDocProp.CustomProperties
sTmp = oCustProp.Name & ": " & CStr(oCustProp.Value)
Selection.InsertAfter sTmp
Selection.InsertParagraphAfter
Selection.Collapse Direction:=wdCollapseEnd
Next oCustProp
End If
End With
End Sub
Which uses that same dll to get access to the custom props. This subroutine
lists all the custom properties in a document, but I can adapt it for my
uses. Thanks for all your help guys,
ROBOHELP X5: Featuring Word 2003 support, Content Management, Multi-Author
support, PDF and XML support and much more!
TRY IT TODAY at http://www.macromedia.com/go/techwrl
WEBWORKS FINALDRAFT: New! Document review system for Word and FrameMaker
authors. Automatic browser-based drafts with unlimited reviewers. Full
online discussions -- no Web server needed! http://www.webworks.com/techwr-l
---
You are currently subscribed to techwr-l as:
archiver -at- techwr-l -dot- com
To unsubscribe send a blank email to leave-techwr-l-obscured -at- lists -dot- raycomm -dot- com
Send administrative questions to ejray -at- raycomm -dot- com -dot- Visit http://www.raycomm.com/techwhirl/ for more resources and info.