richh
Board Regular
- Joined
- Jun 24, 2007
- Messages
- 245
- Office Version
- 365
- 2016
I posted this question on Stack Overflow today, with no results
My question is - How can I set extended properties in a Word Document (not so easy) and read them via the shell in Excel (easy enough) OR set custom properties in Word (easy enough) and read them from Excel (not so easy).
I'm trying to write a program that updates a Word document's metadata with content control boxes. The Excel document then loops through a directory that holds these documents and catalogs them by the metadata. In Word, I can set built-in properties in the DocumentBeforeSave sub via...
and retrieve those in Excel via the shell...
The problem is that there are indexes in the "GetDetailsOf" function that I want to use but can't figure out how to set in Word. For example, I'd like to set the Division (GetDetailsOf index 155), Group (172), Program (277), and Attachments (219) fields. How do you set properties such as these that are not built-in?
Setting Metadata in Word and Retrieving in Excel
I'm trying to write a program that updates a Word document's metadata with content control boxes. The Excel document then loops through a directory that holds these documents and catalogs them by the
stackoverflow.com
My question is - How can I set extended properties in a Word Document (not so easy) and read them via the shell in Excel (easy enough) OR set custom properties in Word (easy enough) and read them from Excel (not so easy).
I'm trying to write a program that updates a Word document's metadata with content control boxes. The Excel document then loops through a directory that holds these documents and catalogs them by the metadata. In Word, I can set built-in properties in the DocumentBeforeSave sub via...
VBA Code:
Application.ActiveDocument.BuiltInDocumentProperties("Keywords").Value = _
Application.ActiveDocument.SelectContentControlsByTitle("Tags").Item(1).Range.Text
and retrieve those in Excel via the shell...
VBA Code:
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(WB.Path & "\QA\")
For Each strFileName In objFolder.Items
inputStr = objFolder.GetDetailsOf(strFileName, 18) 'Tags
'...
'...
next strFileName
The problem is that there are indexes in the "GetDetailsOf" function that I want to use but can't figure out how to set in Word. For example, I'd like to set the Division (GetDetailsOf index 155), Group (172), Program (277), and Attachments (219) fields. How do you set properties such as these that are not built-in?