Previous Document Next Document
DataField.Index

Property Index As Long

Member of DataField

The Index property returns the index number of a data field in the collection. The first item in the collection has the index of 1.

The Index property returns a read-only value.

The following code example shows the list of all data fields defined for the active document and the corresponding data values for the currently selected shape. Note that 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.

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 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.