I’ve an Excel-workbook with ActiveX controls on worksheets (not on Userform!). When I close the workbook (without closing Excel) everything works well, but when I close Excel entirely it triggers Change events of ActiveX Comboboxes on the worksheets. This creates errors because it seems that Excel has done some cleaning already by removing controls.
How can I bypass or solve this? These events shouldn’t trigger in the first place because no values are changed on close.
Without seeing how your ActiveX controls are setup I can’t tell you why their change events are firing. However, assuming the workbook’s BeforeClose event fires before the ActiveX change events, you can add a global variable to track when the workbook is closing.
In a code module:
In ThisWorkbook:
Then only run the change events if not closing the workbook.