Results 1 to 5 of 5

Thread: How to Find what's wrong.

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2010
    Posts
    1,535

    How to Find what's wrong.

    Hi and thanks for reading. I've mentioned this before but not had any luck with a solution.

    My macro's are crashing with a page fault, which makes it impossible for me to debug as not
    only does Excel have to restart all the time but the 'fault' seems to change as
    different Forms or Modules are added or removed - trying to isolate the problem.

    So I have reduced it to a 16MB xlsm file where I can repeatedly do this :-

    There's a STOP statement in the first line of Workbook_Open. The xlsm file loads and
    stops as expected. At this point just entering Stop in Workbook_Open causes the hourglass to appear
    momentarily and then

    Microsoft Office Excel has encountered a problem and needs to close. We
    are sorry for the inconvenience.

    Similarly if I add a breakpoint in Workbook_Open then just scroll the mouse up and down a few times
    the same thing happens.

    Pressing F5 on the Stop statement, may immediately repeat the above, or display error 57121 and then crash very
    soon afterwards. The highlighted error is on a line that has no error.

    How can I proceed to find the cause of this? Does anyone know why it crashes just by adding Stop?
    Do this cause some kind of recompile? Can it be something in my code, even though it hasn't actually executed yet?

    I have rebuilt the xlsm piece by piece after an Excel re-install, and also the same problem happens on more than just my computer.

    Any suggestions very much appreciated - PLEASE!!!

    Thanks, ABB

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: How to Find what's wrong.

    i can offer little as i do not have 2007
    i have found that many errors that occur in same excel versions, under xp are recoverable but under w7 are a total crash
    i have no workbooks at all that are anything like the size you are working with

    Does anyone know why it crashes just by adding Stop?
    i have experienced times when just dropping back to the vba editor will give crashes, especially when using any sub classing, or even API calls

    particularly under w7 i liberally sprinkle my code with doevents to prevent unbreakable loops (maybe loops run faster preventing breaks in w7), though doevents in itself can cause
    unpredictable results on break

    when testing code that appears to cause frequent errors in vba, i often move the code to vb6, which has considerably better error handling (though all errors have to be accounted for), to prevent constant crashing of excel
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2010
    Posts
    1,535

    Re: How to Find what's wrong.

    Thanks for the feedback pete. If it was my bum code I could more than understand... but with it happening before my code runs..... beats me . Error 57121 is hard to fathom. May be connected with Active X controls. I do have 3 comamnd buttoms on one worksheet. Are they Active X? I've just removed them and things have improved, but maybe just changed with trouble still to come. Lots of things made the fault change in ways you could never predict.

    The xls version hasn't the same problems, and these buttons are working - but I'm not convinced it's properly stable either. It has also page faulted, butoverall seems more stable. Don't have w7, just XP.

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: How to Find what's wrong.

    what is the maximum size for stable excel files in any versions?
    what is maximum size for vba project in excel whatever versions?
    there are limitation to both the above and also to how many lines of code, not that i know what they are, and you may be no where near these limits

    i guess they are activex
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2010
    Posts
    1,535

    Re: How to Find what's wrong.

    Quote Originally Posted by westconn1 View Post
    what is the maximum size for stable excel files in any versions?
    what is maximum size for vba project in excel whatever versions?
    Two very good questions pete. I wonder if anyone knows? Something like this would explain a lot - my actual xls filesize is 63MB. This reduces to 27MB when made an xlsm, even though both are the 'same'.

Posting Permissions

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



Click Here to Expand Forum to Full Width