Combobox Additem crashes

st_peters

New Member
Joined
Apr 25, 2016
Messages
3
Hi everyone,

I have been experiencing random Excel crashes when I use the function "ComboBox.AddItem ArrayDirector(i, 1)". The code works perfectly 8 out of 10 times, but every once in a while Excel crashes at the same .AddItem function.

This problem only happens when I start my code/application, when the comboboxes are being initialized and loaded. After that, my function is called several times without any crashes.


Sub Box_Directeurs()

Dim num As Integer
Dim i As Integer
Application.EnableEvents = False

For i = 1 To 4
DirectorBox.AddItem ArrDirector(i, 1)
Next i

Application.EnableEvents = True
End Sub



Also, I've been having the same crashes when I change the caption of a label during the initialization (lbl.caption = currentWeek).

Any help would be greatly appreciated.

Thanks,

Peter
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Peter

Where/how are you populating the array ArrDirector?
 
Upvote 0
Hi,

Thanks for the reply.

Just before I load the combobox, I have a SUB that populates the ArrDirector from data located in an excel sheet.

For your information, I also tried loading the combobox with a string constant and I get the same result: DirectorBox.AddItem "John Smith".

So I dont believe that the problem is with the array.

Thanks again.
 
Upvote 0
Do you get any error message(s)?
 
Upvote 0
Nothing at all. Excel just crashes.

I don't get error messages because it works 90% percent of the time. So i know the code is good. It seems that sometimes it crashes for reasons i don't know (timing issues,...).
 
Upvote 0
Could you upload a sampe workbook, without sensitive data, to a filesharing site like Box.net?
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,825
Members
449,190
Latest member
rscraig11

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top