In your template, use the following steps. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.įor more information, click the following article number to view the article in the Microsoft Knowledge Base:Ģ12536 How to run sample code from Knowledge Base articles in Office 2000 This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This macro can be used as a workaround for the 25-item limitation in drop-down form fields.įor more information about how to do this when you are not using a Microsoft Access database, click the following article numbers to view the articles in the Microsoft Knowledge Base:ġ98561 How to create a combo box containing more than 25 itemsģ06258 How to create a combo box that contains more than 25 items in Word 2002 This article describes how to create and use a UserForm Combo box as an entry macro for a text form field to show information from a Microsoft Access database. 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.For a Microsoft Word 97 version of this article, see 253552. 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. List entries must have unique display names.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |