Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jun 2009
    Location
    Hemet CA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking

    I知 using word 2007 and I知 trying to populate a Combo Box ActiveX Control with
    One
    Two
    Three
    I知 not totally sure how to do it. I believe I use something like
    Code:
    Private Sub ComboBox1_Change()
    Dim myarray(3) As String
    myarray(0) = "One"
    myarray(1) = "Two"
    myarray(2) = "Three"
    ComboBox1.List = myarray
    End Sub
    And is there any way to have the tint added that will change to different colors for each selection.

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    There are a couple of different ways to populate the combobox. I would use the following method
    Code:
    Dim arg As Variant, myArray As Variant
      myArray = Array("One", "Two", "Three")
      
      'Fill list items
      For Each arg In myArray 
    	Me.ComboBox1.AddItem arg
      Next arg
    I don't know of a way to format each item in the combobox differently and would be surprised if it was possible. An acceptable alternative may be to add a second column with the colour name and use a two dimensional array to populate it.
    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
  •