.Net Code Monkey RSS 2.0
 Wednesday, December 03, 2008

Today I realised it was my poor coding that had created a subltle bug that the test team spotted yesterday.

The Bug

The bug was that Excel itself would crash if there was more than one instance of Excel open with my workbook application in one instance and another workbook application in the other and the user attempted to close my workbook via the grey [X].

The Cause

It turned out to be beacuse I had lazily shown and hidden some form objects rather than creating instances of the forms and opening and closing them and clearing up properly by setting these instances to nothing via a call in the "Workbook_BeforeClose" event when the workbook is finished with.

The solution

Once I re-wrote the form handling to be carried out within a "Dialog Manager" module, to work like a static class in C#, with private fields for each form and public properties to access them, the bug seemed to disappear.

Discussions here indicated it would probably be due to undisposed of form refences being present when the workbook is closed. If you have anything further you can add to this issue, please comment below.

Wednesday, December 03, 2008 12:38:34 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
Excel | VBA | Bug
Archive
<September 2010>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789
Blogroll
 Clemens Vasters
 Harry Pierson
Passion * Technology * Ruthless Competence
 Joshua Flanagan
A .NET Software Developer
 Michael Schwarz's Blog
Developing applications on the Microsoft platform since Windows 3.1!
 Omar Shahine
Yet another Microsoft blogger
 Scot GU
Scott Guthrie lives in Seattle and builds a few products for Microsoft
 Scott Hanselman
Programming Life and the Zen of Computers
 Tom Mertens
Tom's corner
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Duane Wingett
Sign In
Statistics
Total Posts: 32
This Year: 6
This Month: 1
This Week: 1
Comments: 35
Themes
Pick a theme:
All Content © 2010, Duane Wingett
DasBlog theme 'Business' created by Christoph De Baene (delarou)