when setting Imagelist for ImageCombot, Excel crash

A

Arnaud

Step to reproduce :
- launch excel (2003 in my case)
- insert an imageList (MSComctlLib.ImageListCtrl.2)
- add 1 picture in it : properties->Custom->Images->Insert Pictures
with index : 1 and key : "aa"
- insert an imageCombot (MSComctlLib.ImageComboCtl.2)
- insert a button
- add the following code to the button :
Private Sub CommandButton1_Click()
Sheet1.ImageCombo1.ImageList = Sheet1.ImageList1
Sheet1.ImageCombo1.ComboItems.Add 1, "aa", "captionaa", "aa"
Sheet1.ImageCombo1.ComboItems.Add 2, "bb", "captionbb", "bb"
End Sub

save your work
--> if you close sheet all is ok
--> if you push button (= if you execute the vba code) and you close sheet
excel crashes

- execute code by pusshing the

I have found this very similar support but it doens't speak about crash :
http://support.microsoft.com/?kbid=194910

What I have done wrong ?
 
I

Ivan F Moala

The only way I have over come this is to set your combobox @ design tim
and not run time.

Also once set, images etc , don't go back and try altering images etc
I have experienced crashes on close down when doing this
 

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