I debugged all day and I figured out that the Application.DoEvents()
can cause AccessViolation exception (it means ~ memory corruption) and
crash Excel.
It usually happens infrequently and randomly, so it was hard to catch it.
I read after, and I found out that this is a reentrancy problem
(facepalm, of course it is):
http://www.techtalkz.com/c-c-sharp/83924-application-doevents.html
So if you don't want to suffer from unexpected side-effects then the
best is not to use DoEvents!
My program uses a Form for logging and for the program's settings and
I thought it would be a good idea to refresh it while excel is doing
the calculation, but my one-line implementation (calling DoEvents) was
the worst idea I had...
Sorry if my letter had no new information for you and thank you Govert
for this great software, we love it btw :)
Thanks,
Tamás Koczka
Ps: sorry for my English