Sub Test() Dim df As DataField Dim di As DataItem Set df = ActiveDocument.DataFields.Add("Weight1") Set di = ActiveShape.ObjectData.Add(df) di.Value = 6End Sub
Sub Test() Dim df As DataField Dim di As DataItem Set df = ActiveDocument.DataFields.Add("Weight2") Set di = ActiveShape.ObjectData.Add(df, 10) MsgBox "The new value of '" & df.Name & "' field is " & di.FormattedValueEnd Sub