Add Method
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

ContentControls.Add Method

Office 2010

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

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

ContentControl Add(
	WdContentControlType Type,
	ref Object Range


Type: Microsoft.Office.Interop.Word.WdContentControlType
Specifies the type of content control to insert into the active document. If omitted, Microsoft Office Word inserts a rich-text content control.
Type: System.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.

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.

© 2015 Microsoft