Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Feb 2001
    Location
    Toronto, Ontario, Canada
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    First On_Click kills the second (Word 2000)

    The template contains 2 buttons for different purposes. When the template is opened, both work fine. When a document based on the template is opened, the first button works, but not the second, unless the second button is clicked first, and then they both work.
    It's difficult to de-bug, because there is no code to step through in the document.
    Any suggestions gratefully received.
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: First On_Click kills the second (Word 2000)

    I can't reproduce the error. You can put a breakpoint on both On Click event procedures (double click in the grey margin to the left of the procedure header). You can then single-step through the code when you click a button.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: First On_Click kills the second (Word 2000)

    As far as I can see, deleting the first command button somehow disconnects the second command button. Instead of deleting the button, I would disable it:

    ActiveDocument.FreqChangeButton.Enabled = False

    And I would move the button a bit so that the new text doesn't have to wrap around it.

  4. #4
    Lounger
    Join Date
    Feb 2001
    Location
    Toronto, Ontario, Canada
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: First On_Click kills the second (Word 2000)

    Thanks Hans. That should fix it.
    When/if you ever get time, it would be interesting to find out how button 1 disables button 2 but button 2 leaves button 1 alone.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: First On_Click kills the second (Word 2000)

    Button 1, by deleting itself, interrupts code execution. Disabling the button instead of deleting it doesn't interrupt the code.

    Button 2 does not delete itself, so code continues to run.

  6. #6
    Lounger
    Join Date
    Feb 2001
    Location
    Toronto, Ontario, Canada
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: First On_Click kills the second (Word 2000)

    Thanks again - makes perfect sense.

Posting Permissions

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