vbams-wordword-field

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


I have two custom column in quick part mapped from sharepoint edit template. DocSigner and DSigneromment

enter image description here

Now i have write macro code in word for get all builtinproperties and custom properties. I am able to get all built in document properties like Author ,Title and all but not able to get that custom column using "CustomDocumentProperties"..

Here is my macro code..

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

So any code changes that i can get all document property from quick part.


Solution

  • @bibadia Thanks a lot for your contribution

    Here is finally i have tried for custom property and it works...

    Sub ListContentTypeProperty()
    
    Dim signer As String
    
    signer = ActiveDocument.ContentTypeProperties.Item("DocSigner")
    
    MsgBox signer
    
    End Sub