ContentControlListEntries.Add(String, String, Int32) Method

Definition

Adds a new list item to a drop-down list or combo box content control and returns a ContentControlListEntry object.

public Microsoft.Office.Interop.Word.ContentControlListEntry Add (string Text, string Value = "", int Index = 0);
abstract member Add : string * string * int -> Microsoft.Office.Interop.Word.ContentControlListEntry
Public Function Add (Text As String, Optional Value As String = "", Optional Index As Integer = 0) As ContentControlListEntry

Parameters

Text
String

Specifies the display text for the list item. Corresponds to the Text property for a ContentControlListEntry object.

Value
String

Specifies the value of the list item. Corresponds to the Value property for a ContentControlListEntry object. If omitted, the Value property is equal to the Text property.

Index
Int32

Specifies the ordinal position of the new item in the list. If an item exists at the position specified, the existing item is pushed down in the list. If omitted, the new item is added to the end of the list.

Returns

ContentControlListEntry

Remarks

List entries must have unique display names. Attempting to add a list item that already exists raises a run-time error.

Applies to