EISTO
asked on
ActiveX Listbox events do not fire
Hi there,
I've got a form in an Excel VBA program that contains listboxes displaying user selections. When these listboxes are emptied, I want to disable a commandbutton on the form to prevent the user from continuing without having selected an item. Correspondingly, I want to enable this commandbutton as soon as something is written to the listbox again. All adding/deleting of items in the listbox is handled by the code.
I thought this was easy to achieve using events, but neither the listbox_change event nor the listbox_afterupdate event fires when an item is added to or removed from the listbox. Why not? What kind of event should I use?
best regards,
Einar
I've got a form in an Excel VBA program that contains listboxes displaying user selections. When these listboxes are emptied, I want to disable a commandbutton on the form to prevent the user from continuing without having selected an item. Correspondingly, I want to enable this commandbutton as soon as something is written to the listbox again. All adding/deleting of items in the listbox is handled by the code.
I thought this was easy to achieve using events, but neither the listbox_change event nor the listbox_afterupdate event fires when an item is added to or removed from the listbox. Why not? What kind of event should I use?
best regards,
Einar
what about the exit event, isn't it firing ?
ASKER
Hi, Fernando
No, the exit event doesn't fire either
/Einar
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Fernando,
I could write code in each and every routinge that manipulates the contents of the listbox, but it would be a whole lot easier to write it once and for all in an event handler.
....as far as I know, the application.enableevents property does not affect ActiveX-events. It is only applicable to events of objects inherent to Excel.
/Einar
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks guys,
VBA seems to be unable to handle this, so let's close the thread.
/Einar
VBA seems to be unable to handle this, so let's close the thread.
/Einar