PDA

View Full Version : Solved: Disable One Procedure While Another Runs Then Enable Again



f2e4
06-04-2008, 04:43 AM
I have a listbox connected to a chart that depending on the value selected, will refresh the chart with a different series.

However, the code I use to calculate all the core data for the charts , keeps crashing only while the coed for the listbox is active.

Is there anyway to diactivate the listbox_change code while the caculation code is running, then once finished, enables the listbox code again.

Thanks

F

Bob Phillips
06-04-2008, 04:58 AM
You need to create a public variable, and set that when the calculate macro starts and unset it at the end. Your listbox code then checks this variable, and exits quietly if set.

f2e4
06-05-2008, 01:09 AM
I think i'm having a real rain freeze at the minute.

Can anyone explain this, e.g. how to set and unset a public variable, and have it checked before running code.

Bob Phillips
06-05-2008, 02:40 AM
standard code module



Public RunList as Boolean


in the controlling code



RunList = False

'working code

RunList = True


Listbox code


If RunList Then

'do its stuff

End If

f2e4
06-05-2008, 03:16 AM
Hey,

That works perfectly

Thanks again,

F