Adds a field
Syntax:
Function Add(ByVal Name As String, Optional ByVal Format As String, Optional ByVal AppDefault As Boolean = False, Optional ByVal DocDefault As Boolean = False, Optional ByVal SummarizeGroup As Boolean = False) As DataField
Parameters:
Name Type Description
Name
String
Format
String
AppDefault
Boolean
Specifies the data field as a default field.
DocDefault
Boolean
Specifies the data field as a default field in the document.
SummarizeGroup
Boolean
Specifies whether to summarize the data field.
Remarks:
The Add method adds a data field.
Examples:
The following VBA example adds a new data field named Weight and specifies a custom data format (which displays two digits after the decimal point and places the kg suffix after the number).
Sub Test()
ActiveDocument.DataFields.Add "Weight", "#,##0.00 ""kg""", False, True, False 
End Sub