Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Disable Events (Word 97SR2)

    I know this comes around from time to time but I've got to ask it again 'cause I'm still stumped.

    How do I disable events for check box or a combobox control?

    I want to programmatically set the check box, but I don't want the _change event to fire.

    I tried
    with me
    .checkbox.enabled = false
    .checkbox.value = true
    .checkbox.enabled = true
    end with

    but the change event fires even though the checkbox is disabled. Apparently, that trick only works with *some* controls and not others.

    The only workaround is a messy global var set in the calling sub and tested for in the event. Is there a *right* way to do this?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Disable Events (Word 97SR2)

    < Is there a *right* way to do this >

    I have no idea, but if you are prepared to set the enabled property on and off , why bother with a global variable. Just test for the Enabled property, and if False skip the code otherwise run it. Just a thought

    Andrew

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Disable Events (Word 97SR2)

    I see. Let the event fire as I'm doing and just check the enabled property: exit if disabled, continue if enabled. Ok, that's fairly painless.

    I also thought of just using the .tag property. Same difference.

    I was hoping there was some command to turn off events, the re-enable them. That could be dangerous, no?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Disable Events (Word 97SR2)

    I don't know of any command to switch off events for controls. In Excel Application.EnableEvents = False ( I don't think Word has an equivalent ) does not extend to ActiveX controls. I would think using the controls own properties ( Tag or Enabled etc ) is as good a way as any, provided enough care is taken so that all properties are reset.

    Andrew

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Disable Events (Word 97SR2)

    I think that's good enough for now. Thanks for your thoughts.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

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