![]() Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback. Word Object Model Reference Support and feedback If objCL.Text = "Other" Then objCL.Delete ObjCC.Type = wdContentControlDropdownList Thenįor Each objCL In objCC.DropdownListEntries If objCC.Type = wdContentControlComboBox Or _ Dim objCC As ContentControlįor Each objCC In ActiveDocument.ContentControls The following code example deletes a drop-down list item if the display text of the item is "Other". Use the Delete method to remove an item from a content control drop-down list or combo box. ![]() ObjLE.Value = "My favorite animal is the " & strText & "." Set objCc = ActiveDocument.ContentControls(3)įor Each objLE In objCC.DropdownListEntries The following code example sets the value for the item based on the contents of the display text. Also, the value of the Value property is what is sent to the custom XML data if the content control is mapped to XML data in the data store. You can then use the product number from the Value property to look up product information in a database. The Value property may contain the product number for the product that corresponds to a product number in a database. The Text property may contain the name of the product, a display name that a user can easily recognize and understand. For example, you may use a content control drop-down list for a list of products. Use the Text property to set the display text for a content control list item, and use the Value property to set a programmatic value that you may use later for processing a form. ObjCC.SetPlaceholderText, , "Select your favorite animal " The following code 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. Use the Select method to programmatically select a content control list item. Objcc.Type = wdContentControlDropdownList Then If objcc.Type = wdContentControlComboBox Or _ The following code example moves the first item down, so that it becomes the last item in the list, and moves the last item up, so that it becomes the first item in the list. Use the MoveUp and MoveDown methods to reposition items in a drop-down list. Set objCC = (wdContentControlDropdownList) The following code example uses the Add method to add several list items to a new drop-down list content control, and then uses the Item method to access the third item in the list and change the display text. Attempting to add a list item that already exists raises a run-time error. In the list, select the Developer check box, and then click OK. Under Customize the Ribbon, click Main Tabs. List entries must have unique display names. If you havent enabled the Developer tab yet on Word, follow these steps: Open Word 2013.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |