View Single Post
 
Old 04-15-2015, 05:56 AM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You haven't said what type of property, but the following example uses both built-in and custom properties and should point the way.

Code:
Sub add()

Dim oTable As Table
Dim oCell As Cell
Dim oNewRow As Row
Dim oDocProp As DocumentProperty

    ' Insert new row
    Set oTable = ActiveDocument.Tables(1)
    Set oNewRow = oTable.Rows.add

    For Each oDocProp In ActiveDocument.BuiltInDocumentProperties
        If oDocProp.name = "Author" Then
            oNewRow.Cells(1).Range.Text = oDocProp.Value
        End If
        If oDocProp.name = "Title" Then
            oNewRow.Cells(2).Range.Text = oDocProp.Value
        End If
    Next oDocProp
    For Each oDocProp In ActiveDocument.CustomDocumentProperties
        If oDocProp.name = "MyPropName1" Then
            oNewRow.Cells(3).Range.Text = oDocProp.Value
        End If
        If oDocProp.name = "MyPropName2" Then
            oNewRow.Cells(4).Range.Text = oDocProp.Value
        End If
        If oDocProp.name = "MyPropName3" Then
            oNewRow.Cells(5).Range.Text = oDocProp.Value
        End If
       
    Next oDocProp
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote