Multiselect listbox with check boxes

K

Kandi

The code below creates a multiselectable listbox with check boxes linked to a
named range. The code creates the box. However, you cannot select the box
or any of the checkboxes.
There are two ways around this problem. Either turn on and off design mode
OR select another worksheet then select the worksheet with the listbox.

Is this a bug or did I leave something out? This does not seem like normal
behavior. It almost seems as if the items are locked or disabled. I am
using Office 2003 and tried different computers to make sure is was not a
software issue.


Sub test()
lbdoawidth = 100
lbdoaover = 250
lbdoafromtop = 75
lbdoaheight = 75
lbdoadropdownlns = 7
x = 1
incremental = 100
' create listbox and populate with named range. Check boxes and multi
select enabled

Sheets("sheet3").OLEObjects.Add(ClassType:="Forms.ListBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=lbdoaover, Top:=(lbdoafromtop +
incremental), Width:=lbdoawidth, Height:= _
lbdoaheight).Select
selectionname = "lbdoa" & x
With Selection
.Name = "lbdoa" & x
.ListFillRange = "expdoa"
End With
'ActiveSheet.OLEObjects(selectionname).Object.MultiSelect = fmMultiSelectMulti
ActiveSheet.OLEObjects(selectionname).Object.MultiSelect = 1
ActiveSheet.OLEObjects(selectionname).Object.ListStyle = fmListStyleOption
ActiveSheet.OLEObjects(selectionname).Object.BoundColumn = 1
ActiveSheet.OLEObjects(selectionname).Object.ColumnCount = 1
ActiveSheet.OLEObjects(selectionname).Object.Enabled = True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top