UPDATE: I have completely resolved this problem - see reply below!
Hi All.
This issue is driving me nuts. I know that there is an instability in Office 2010 that is the cause of this and that similar problems have been reported by a number of users on different fora, but I am still trying to find a workaround that works for me. Please bear with me while I describe the issue:
The Situation
I have a large project built in Excel - it is a complex statistical model with a userform GUI. It consists of 81 worksheets, 6 userforms and 10 VBA modules. The overall size of the .xlsm file is <4Mb. The VBA files are password-protected in VBEditor.
Of the VBA files, the largest BAS is 36Kb and the largest FRX is 141Kb. The largest userform contains 506 controls. Everything compiles fine.
The workbook is arranged such that only one sheet is visible, containing a launch button for the tool's GUI, which automatically initializes when the work book opens via the Workbook_Open procedure in the ThisWorkbook module.
The Problem
Sometimes Excel will crash when opening the workbook ("Microsoft Excel has stopped working..."). Through many hours of trial and error I have confirmed that:
1) it is the initialization of the main userform that is triggering Excel to crash - removing the Workbook_Open procedure stops Excel from crashing on opening but it still crashes as soon as the userform is launched
2) opening the workbook in Protected View doesn't stop it from crashing once "Enable editing" has been clicked
3) Open and Repair sometimes resolves the problem, until the next time it is saved
4) if I am able to get the VBA files open and make a save from within VBEditor sometimes it can then be closed and reopened successfully - but moving the workbook to a new directory or saving it the brings the problem back
5) saving the workbook via VBA ThisWorkbook.Save also causes Excel to crash next time the workbook is re-opened
5) disabling password protection within VBEditor seems to resolve the problem, but this tool is being published and has to be protected so disabling it permanently is not an option.
Potential Solutions
Several things have been suggested in other post; I have tried the following, with no success:
1) CodeCleaner
2) I was already using Option Explicit
3) changing all object references from text handles such as Userform1.CommandButton1.Visible to index references like Userform1.Controls.Items(1).Visible
When I allow Visual basic to debug Excel, it produces the error Unhandled exception at 0x73C1C9F1 in EXCEL.EXE: 0xC0000005: Access violation executing location 0x00000000. at the line:
Any Ideas?![]()
Please Login or Register to view this content.
I have been struggling with this for weeks. The project is a national public sector tool and I really need to get it sorted. The only remaining issue that I can see is the size of the main userform - 141Kb and 506 controls. I appreciate that there is a 64Kb maximum limit for modules (which still amazes me in the era of modern computing) but I can't see an eloquent way of splitting the form into two smaller packets. I have tried stripping all procedures in the userform code down to simply calling routines in other modules but this didn't considerably reduce the size of the FRX file, which I assume is a result of the number of controls.
Does anyone have any suggestions? I cannot provide an unlocked copy of the tool but I can provide snippets of code if that is likely to help.
Many thanks,
AdLoki
Bookmarks