Fields.Add method

Adds a Field object to the Fields collection.

Namespace:  Microsoft.Office.Interop.Word
Assembly:  Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)

Field Add(
	Range Range,
	ref Object Type,
	ref Object Text,
	ref Object PreserveFormatting


Type: Microsoft.Office.Interop.Word.Range

Required Range object. The range where you want to add the field. If the range isn't collapsed, the field replaces the range.

Type: System.Object

Optional Object. Can be any WdFieldType constant. For a list of valid constants, consult the Object Browser. The default value is wdFieldEmpty.

Type: System.Object

Optional Object. Additional text needed for the field. For example, if you want to specify a switch for the field, you would add it here.

Type: System.Object

Optional Object. True to have the formatting that's applied to the field preserved during updates.

This method returns the Field object at the specified range.

You cannot insert some fields (such as wdFieldOCX and wdFieldFormCheckBox) by using the Add method of the Fields collection. Instead, you must use specific methods such as the AddOLEControl method and the Add method for the FormFields collection.