![]() |
|
#1
|
||||
|
||||
![]()
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 |
#2
|
|||
|
|||
![]()
Thank you so much, exactly what I was looking for!
|
![]() |
Tags |
document properties, table |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
donaldadams1951 | Word VBA | 4 | 02-04-2015 03:54 PM |
![]() |
htieK | Excel | 5 | 10-28-2014 06:23 PM |
![]() |
thedr9wningman | Word VBA | 3 | 01-20-2014 05:56 PM |
![]() |
Popeye.Tom | Word Tables | 1 | 04-24-2013 09:44 PM |
Properties of a Cell | DrDOS | Excel | 1 | 04-06-2012 08:49 PM |