Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Arkansas, USA
    Posts
    163
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multiple ComboBoxes with same data (Word 2000)

    There should be a way to use a For..Next loop to supply the data for multiple comboBoxes. I have 12 comboboxes (combobox1, combobox2, etc) that I want to have populated with the same items. I have experimented with using For...Next, but am having trouble substituting the number for the variable. I assume there must be a way to substitute the number following "Combobox" with the numbers 1 to 12 in a loop without having to copy the code 11 more times.

    Thanks in advance

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Multiple ComboBoxes with same data (Word 2000)

    I don't know how to do that, but you could do something like this:

    Dim sh As InlineShape
    For Each sh In ActiveDocument.InlineShapes
    If sh.Type = wdInlineShapeOLEControlObject Then
    With sh.OLEFormat
    If .ClassType = "Forms.ComboBox.1" Then
    .Object.AddItem "This"
    .Object.AddItem "That"
    End If
    End With
    End If
    Next sh

Posting Permissions

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