Consulting

Results 1 to 5 of 5

Thread: Solved: Disable One Procedure While Another Runs Then Enable Again

  1. #1
    VBAX Contributor
    Joined
    Nov 2007
    Posts
    144
    Location

    Solved: Disable One Procedure While Another Runs Then Enable Again

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Contributor
    Joined
    Nov 2007
    Posts
    144
    Location
    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.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    standard code module

    [vba]

    Public RunList as Boolean
    [/vba]

    in the controlling code

    [vba]

    RunList = False

    'working code

    RunList = True
    [/vba]

    Listbox code

    [vba]
    If RunList Then

    'do its stuff

    End If
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Contributor
    Joined
    Nov 2007
    Posts
    144
    Location
    Hey,

    That works perfectly

    Thanks again,

    F

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •