ContentControls.Add Method
Word Developer Reference |
Adds a new content control, of the type specified, into the active document and returns a ContentControl object that represents the new content control.
Syntax
expression.Add(Type, Range)
expression An expression that returns a ContentControls object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Type | Optional | 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 | Optional | Variant | 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. |
Return Value
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.
Example
The following example creates a new drop-down list content control and adds several items to the list.
Visual Basic for Applications |
---|
|
See Also
- ContentControls Collection
- ContentControls Object Members
- How to: Bind a Content Control to a Node in the Data Store
- How to: Bind Controls to a Specific Row in the Data Store When Inserting a Building Block
- How to: Capture and Respond to Events in the Data Store
- How to: Change a Content Control from One Type to Another
- How to: Change the Editability of a Content Control
- How to: Insert a Content Control into a Building Block
- How to: Remove Data from the Data Store When Deleting a Content Control
- How to: Set the Building Blocks That You Can Use for a Content Control
- Walkthrough: Connect an Item in the Data Store to a SQL Server Database
- Walkthrough: Connect an Item in the Data Store to a Web Service
- Walkthrough: Connect an Item in the Data Store to an Access Database
- Walkthrough: Connect an Item in the Data Store to an Excel Workbook
- Working with Content Controls