Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Aug 2010
    Location
    USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How to display first item in a Word 2010 drop-down box

    OK....I have a WORD 2010 document with various DropDown boxes. On the "Document_Open()" sub-routine I need to fill certain DropDown boxes with items from a file. No problem with that. The issue I have is the DropDown box is in fact filled with the items from the file, but on the document the DropDown box field is blank. It only shows the entries when you click on the DropDown box.

    I can't figure out how in the Open_Document() sub routine to force the DropDown box to display the first item, so the field is not blank on the document.

    Any help would be appreciated. Thanks. Bob

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,515
    Thanks
    3
    Thanked 143 Times in 136 Posts
    Is this drop down box a Content Control? If so, the following might give you a clue
    Code:
    Sub aa()
      With ActiveDocument.ContentControls(1)
        .DropdownListEntries.Clear
        .DropdownListEntries.Add "hello mum"
        .DropdownListEntries.Add "hi dad"
        .Range = .DropdownListEntries.Item(1)
      End With
    End Sub
    On a vba userform you use the .ListIndex property eg.
    Me.ListBox1.ListIndex = 1
    although the first entry may be 0 because that list may be zero-based.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •