Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Click event on listbox
I have a dialog that controls an interactive chart. This has a number of
listboxes, all of which have click events attached. When the user selects an option in a box (say ListIndex = 4) that produces a combination of choices that is not allowed, I need to revert the listbox to a permissible option (say ListIndex =0). Unfortunately, this just seems to create a new click event that, for some reason, reverts the ListIndex back to the unpermissible option (i.e. 4) and repeats the error. Is there any way to stop these recurrent click events. I have tried using a static boolean expression and disabling events, but it does not seem to to stop the macro 'circling' at least twice. Ian |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Click event on listbox
Application.enableevents = false
to turn events off. Be usre to turn them back on with Application.enableevents = true As these are application level evnet sit is a good idea to have an error handler which resets the events in the event of a problem. Also when you are debugging be carefule about stopping execution half way through. Your events will be off and the code will seem to be not reacting as it should... HTH "IanC" wrote: I have a dialog that controls an interactive chart. This has a number of listboxes, all of which have click events attached. When the user selects an option in a box (say ListIndex = 4) that produces a combination of choices that is not allowed, I need to revert the listbox to a permissible option (say ListIndex =0). Unfortunately, this just seems to create a new click event that, for some reason, reverts the ListIndex back to the unpermissible option (i.e. 4) and repeats the error. Is there any way to stop these recurrent click events. I have tried using a static boolean expression and disabling events, but it does not seem to to stop the macro 'circling' at least twice. Ian |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Click event on listbox
Many thanks.
The click event still repeats itself, but only after it has reached End Sub for the first time. And its ListIndex still reverts at that stage to the original (unpermissible) value. Taking out the change to ListIndex solves the problem (so I am reasonably certain that is the problem), but still leaves the original value showing in the ListBox. "Jim Thomlinson" wrote: Application.enableevents = false to turn events off. Be usre to turn them back on with Application.enableevents = true As these are application level evnet sit is a good idea to have an error handler which resets the events in the event of a problem. Also when you are debugging be carefule about stopping execution half way through. Your events will be off and the code will seem to be not reacting as it should... HTH "IanC" wrote: I have a dialog that controls an interactive chart. This has a number of listboxes, all of which have click events attached. When the user selects an option in a box (say ListIndex = 4) that produces a combination of choices that is not allowed, I need to revert the listbox to a permissible option (say ListIndex =0). Unfortunately, this just seems to create a new click event that, for some reason, reverts the ListIndex back to the unpermissible option (i.e. 4) and repeats the error. Is there any way to stop these recurrent click events. I have tried using a static boolean expression and disabling events, but it does not seem to to stop the macro 'circling' at least twice. Ian |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
capture listbox click | New Users to Excel | |||
ListBox Click Event | Excel Discussion (Misc queries) | |||
click event on listbox | Excel Programming | |||
Listbox on click | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming |