如何使用宏在word中显示quick part > document 属性?

How to display quick part > document property in word using macro?

我在共享点编辑模板映射的快速部分中有两个自定义列。 DocSigner 和 DSigneromment

现在我已经用 word 编写了宏代码来获取所有内置属性和自定义属性。我能够获取所有内置文档属性,如作者、标题和所有但无法使用 "CustomDocumentProperties"..

获取自定义列

这是我的宏代码..

Sub ListAllProperties()

 Dim rngDoc As Range
 Dim proDoc As DocumentProperty

 Set rngDoc = ActiveDocument.Content

 rngDoc.Collapse Direction:=wdCollapseEnd

 For Each proDoc In ActiveDocument.CustomDocumentProperties 

 With rngDoc
   .InsertParagraphAfter
   .InsertAfter proDoc.Name & "= "
   On Error Resume Next
   .InsertAfter proDoc.Value
 End With

 Next

End Sub

所以我可以从快速部分获取所有文档的任何代码更改 属性。

要获取来自自定义 SharePoint 列的属性值,请使用文档的 ContentTypeProperties 集合。

@bibadia 非常感谢你的贡献

这是我终于尝试了自定义 属性 并且有效...

Sub ListContentTypeProperty()

Dim signer As String

signer = ActiveDocument.ContentTypeProperties.Item("DocSigner")

MsgBox signer

End Sub