Prgrammatically added OLE Listbox, now cannot select from it

Giganews Newsgroups
Subject: Prgrammatically added OLE Listbox, now cannot select from it
Posted by:  happyheth (happyhe…@gmail.com)
Date: Mon, 5 May 2014

Hi,

I have a macro that creates an OLEobject list box and popualtes it. Once the macro ends, I cannot select from the listbox unless I switch into design mode and back out.

I have a single activex button that runs this code.

Private Sub CommandButton1_Click()
    Set lb1 = ActiveSheet.OLEObjects.Add(ClassType:="Forms.ListBox.1", _
              Link:=False, DisplayAsIcon:=False, Left:=10, Top:=currX, Width:=560, Height:=60)

    With lb1.Object
        .AddItem
        .ColumnCount = 4
        .ColumnWidths = "100;150;150;150"
        .List(0, 0) = " "
        .List(0, 1) = "Database"
        .List(0, 2) = "Server"
        .List(0, 3) = "Version"
    End With
End Sub

Once complete, I what to select the row displayed but cannot. Help?

Replies