Combination button/dropdown in office -
how add combination button/dropdown in office (see below). preferably code.
update: if helps any, code isn't needed.
you can it, based on following activex controls:
- microsoft imagelist control, version 6
- microsoft imagecombobox control, version 6
manually, select "more controls..." [control toolbox] menu bar , double click mentioned controls them on sheet. position combobox want be, , disregard position of imagelist, visible in design mode. have 2 embedded contros named
- imagelist1
- imagecombo1
the insertion of 2 components creates reference ...\system32\mscomctl32.ocx.
then you
- manually add icons (gif, bmp, etc) image list
- manually set combo's imagelist property "imagelist1"
- manually set combo's autoload property true
by have combo error no icons.
then execute code
sub fillcombo() dim sh worksheet, oo oleobjects, idx integer set sh = activesheet set oo = sh.oleobjects oo("imagecombo1").object .comboitems.clear idx = 1 oo("imagelist1").object.listimages.count .comboitems.add , , , idx next idx end end sub
i've tried hard create objects vba, imagecombo seems behave different when created as
set sh = activesheet set oo = sh.oleobjects oo.add "mscomctllib.imagecomboctl.2" ' .... etc ....
the combo created, dropdown arrow not displayed no matter do, allthough debugger shows listview elements neatly attached. lots of colleagues seem have problems activex, there's loads of posting on net.
further reading here
Comments
Post a Comment