ContentControlListEntry.Select 方法 (Word)ContentControlListEntry.Select method (Word)

下拉式清單或下拉式方塊內容控制項中選取清單項目,並將內容控制項的文字設定項目的值。Selects the list entry in a drop-down list or combo box content control and sets the text of the content control to the value of the item.

語法Syntax

運算式選取expression.Select

_運算式_會傳回ContentControlListEntry物件的運算式。expression An expression that returns a ContentControlListEntry object.

範例Example

下列範例會將下拉式清單內容控制項插入使用中文件、設定標題和預留位置文字,並將多個項目加入至此清單,然後選取最後一個輸入的項目。The following example inserts a drop-down list content control into the active document, sets the title and placeholder text and adds several items to the list, and then selects the last item entered.

Dim objCC As ContentControl 
Dim objCE As ContentControlListEntry 
Dim objMap As XMLMapping 
 
Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList) 
objCC.Title = "My Favorite Animal" 
If objCC.ShowingPlaceholderText Then _ 
 objCC.SetPlaceholderText , , "Select your favorite animal " 
 
'List entries 
objCC.DropdownListEntries.Add "Cat" 
objCC.DropdownListEntries.Add "Dog" 
objCC.DropdownListEntries.Add "Horse" 
objCC.DropdownListEntries.Add "Monkey" 
objCC.DropdownListEntries.Add "Snake" 
 
Set objCE = objCC.DropdownListEntries.Add("Other") 
objCE.Select

請參閱See also

ContentControlListEntry 物件ContentControlListEntry Object

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.