+ Reply to Thread
Results 1 to 2 of 2

Excel resets project without error when ending a sub

  1. #1
    Registered User
    Join Date
    02-17-2020
    Location
    Germany
    MS-Off Ver
    2019
    Posts
    28

    Excel resets project without error when ending a sub

    Hi everyone,

    my Excel program has developed a very strange behavior and I have no clue what's going on. I hope you can help me out.

    When clicking on a certain button, the method "Click2Select_Click" is started and the the user has to click through the userform "Form_SelectScoringFunction", some calculations happen, all is good. After unloading the userform, the value of numberOfAlternatives, used as an indicator for all other variables, is still 1. Great! It is continues to equal to 1 when moving to End Sub with F8. Upon actually ending the sub, every variable I use, no matter if public or private, goes to 0 or False. Print Err.Number simply leads to "0".
    Please Login or Register  to view this content.
    Now what's really puzzling me is that after rebooting Windows, the program works fine for some iterations (~5x) until this bug reoccurs. Therefore, I guess it's not actually a direct problem of my coding but some higher-level stuff that I have no clue of. So there is a chance that the problem will not even happen on your computer but here's a guide on how to get there and you find my file attached.
    1. Just click "skip" on the UI that pops up on startup.
    2. The table is already reset but you can click on reset again if you want to make sure. All variables have their original value now, numberOfAlternatives e.g. should be 1.
    3. Click on any "Click to select a scoring function". Select any that you wish, doesn't matter. Choose "Manual scoring" and click "Confirm" (you can also choose "Automated scoring" if you want to play around but it makes things more complicated and the result is the same).
    4. Voilą, all variables are gone. You can check using Print and any variable or you can simply click on "4. Weighting". If the bug appeared, there'll be no textboxes.

    Edit: The Click2Select_Click Sub can be found in "Modul2".
    Edit2: Just what I feared. After saving "ForTesting" and closing Excel, both files worked fine again. But after some time playing around, it started again. How is this possible?
    Edit3: The problem is still occuring but I developed a routine to prevent it from having impacts. Attachement removed.
    Last edited by Menohavename; 05-31-2020 at 03:05 PM.

  2. #2
    Registered User
    Join Date
    02-17-2020
    Location
    Germany
    MS-Off Ver
    2019
    Posts
    28

    Re: Excel resets project without error when ending a sub

    Okay, it seems I could narrow the issue down to something related to copying images - something that happens inside Click2Select_Click. But not it's not only happening during some algorithms but while editing user forms in the VBA editor! I managed to capture it:
    Attachment 679579
    This also happens when inserting a totally new image. And it keeps happening even after rebooting. It seems like it occurs especially at later stages of using the tool, when multiple images are already in use. If I reset the sheet, I can copy the image just like in the gif without a problem.

    Again: How is this possible? Does it have to something to do with a buffer overload or something like that? And even more: How can I prevent this from happening?
    Last edited by Menohavename; 05-26-2020 at 11:23 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. DataBinding in an Excel Workbook project causing an error when I insert rows.
    By jalley in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-26-2016, 04:39 PM
  2. [SOLVED] Help! Cannot use excel - Can't find project or library VBA error
    By Kencosgrove in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-29-2015, 06:59 AM
  3. [SOLVED] Form nightmare - project resets = global variables lost
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-30-2014, 11:36 PM
  4. Windows 8, Excel 2013 and Project 2010 - Reference Error in Macro
    By microsoftexcel007 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2013, 06:23 PM
  5. Ending a Loop in VBA, 91 error
    By MZing81 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2012, 05:37 PM
  6. pivot table custom name resets (excel 2007)
    By bkj123 in forum Excel General
    Replies: 5
    Last Post: 03-25-2011, 12:19 PM
  7. Not ending on an error
    By omgeokid in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-14-2011, 11:29 AM

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