+ Reply to Thread
Results 1 to 1 of 1

WithEvents - same code run 2 ways: one causes crash

  1. #1
    Registered User
    Join Date
    08-21-2011
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    7

    WithEvents - same code run 2 ways: one causes crash

    Hi,

    I have a test spreadsheet with a button control array, Events attached and a right-click context menu.

    Clicking a checkbox (on or off doesn't matter) will delete any buttons present, recreate the 9 buttons as part of a control array and attach events. It also creates a right-click contextmenu (it runs twice to show no problems).

    Once the checkbox has been clicked at least once, you can right-click any button, select "ReDo" and the same code will run again (twice - to illustrate the problem).

    Only this time it will likely crash (if it doesn't right-click on a button and select ReDo again and it surely will).

    In my actual project I need to be able to right click on one or more buttons so the crashing is bad news.

    Why does it crash one way (context menu) and not the other (checkbox) as the same code is running (apart from creating the contextmenu)?

    It's driving me crazy! Any ideas why and how to stop it?

    Test spreadsheet attached in 97~2003 format, code below.

    Thanks for your help.

    Code in Worksheet called "Scenario":

    Please Login or Register  to view this content.

    Code in module called ProjectModule:
    Please Login or Register  to view this content.
    Code in event class called clsActiveXEvents:
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1