Edit

Share via


ContentControls.Add(WdContentControlType, Object) Method

Definition

Adds a new content control, of the type specified, into the active document and returns a ContentControl object that represents the new content control.

public Microsoft.Office.Interop.Word.ContentControl Add (Microsoft.Office.Interop.Word.WdContentControlType Type = Microsoft.Office.Interop.Word.WdContentControlType.wdContentControlRichText, ref object Range);
abstract member Add : Microsoft.Office.Interop.Word.WdContentControlType * obj -> Microsoft.Office.Interop.Word.ContentControl
Public Function Add (Optional Type As WdContentControlType = Microsoft.Office.Interop.Word.WdContentControlType.wdContentControlRichText, Optional ByRef Range As Object) As ContentControl

Parameters

Type
WdContentControlType

Specifies the type of content control to insert into the active document. If omitted, Microsoft Office Word inserts a rich-text content control.

Range
Object

Specifies where in the active document to place the content control. If omitted, Word places the content control at the position of the insertion point or replaces the current selection.

Returns

ContentControl

Remarks

You can nest content controls only within rich-text content controls, building block gallery content controls, and group content controls. If the insertion point or current selection is inside a content control of a different type, this method raises an error. In this case, you can either move the insertion point or use the Range parameter to specify a location within the document.

Applies to