Listbox: add a combobox as Item?

excel, vba

Solution

If you are not planning on distributing your application then you can also look at the TreeView Control. See this example.

CODE

Private Sub CommandButton1_Click()
    With TreeView1.Nodes
        .Add , , "R1", "Root 1"
        .Add "R1", tvwChild, , "Test 1"
        .Add "R1", tvwChild, , "Test 2"
        .Add "R1", tvwChild, , "Test 3"
        .Add "R1", tvwChild, , "Test 4"
        .Add "R1", tvwChild, , "Test 5"

        .Add , , "R2", "Root 2"
        .Add "R2", tvwChild, , "Test 11"
        .Add "R2", tvwChild, , "Test 22"
        .Add "R2", tvwChild, , "Test 33"
        .Add "R2", tvwChild, , "Test 44"
        .Add "R2", tvwChild, , "Test 55"
    End With
End Sub

SNAPSHOT

USING THE CONTROL

To be able to use the Treeview Control, your system must have `MSCOMCTL.OCX` registered. You can then add the control by Right Clicking on the

SNAPSHOT

DESIGN TIME SNAPSHOT

DOWNLOAD THE OCX

If you do not have the OCX then you can download it from here

Problem

Is it possible to make every item of a listbox as a combobox? I need this because i made the listbox as checkable and then I need to make the user to choose from different options for every element of the list. Thanks!

Original source