I've created a Sudoku solver using VBA in Excel 97. Although the solver normally works okay it periodically seems to malfunction. Fix is always to exit Excel completely and then re-open the spreadsheet. Largest global by far is Private boolArrCellValues(1 To 16, 1 To 16, 1 To 16) As Boolean, so I don't think I'm taxing memory storage.
I am definitely explicitly initializing all globals when macro starts. However, I get different results on the same puzzle, so it can't be a coding error (else the malfunction would always yield the same wrong results). Apparently, Excel 97 is susceptible to some sort of memory leak.
Is there a way of protecting my global variables and protecting the system memory allocated to Excel to prevent corruption? I'm running Win XP, on a P4 (3 GHz) with 1 gb memory. Application has 8 separate command buttons, each invoking their own code against the shared global variables. There is only about 1000 lines of code involved, so it doesn't seem as if the system should be overloaded.
I use boolArrCellValues(row, column, candidate) to maintain candidates for each cell, and only write to a cell when there is any change to one of its 16 booleans. Processing seems clean so I can't think of a way to streamline.
Application seems made to order for Excel, but I need to diagnose/resolve recurring memory corruption. Is this a known problem in Excel 97? Will upgrading to Excel 2003 make the problem disappear. If I have to migrate to VB6 (which I have a copy of) is there a free VB6 component that will facilitate a spreadsheet type of Sudoku presentation?
Bookmarks