|   |   | Object Model Reference : Classes : D : DataField : Properties : DataField.Index | 
Property Index As Long
Member of DataField
The Index property returns the index number of a data field in a collection. The first item in the collection has an index number of 1.
The Index property returns a read-only value.
The following VBA example shows the list of all data fields defined for the active document and the corresponding data values for the currently selected shape.
| Sub Test() | 
|  Dim s As String | 
|  Dim df As DataField | 
|  s = "Data Fields available:" & vbCr | 
|  For Each df In ActiveDocument.DataFields | 
|   s = s & vbCr & df.Name & " = " & ActiveShape.ObjectData(df.Index).Value | 
|  Next df | 
|  MsgBox s | 
| End Sub | 
 
| • | This code fails if there are any data fields that are not part of the document 
default and their values are not set to the shape.
 | 
|   |   |   | 
Copyright 2013 Corel Corporation. All rights reserved.