Without getting into the details of the code I have a VBA Excel program that shows a Userform at the user at some point in the code. This VBA Excel program is used for more then 10 years now without any problem. Suddenly from one day to another we get an automation error where Excel Finally Crashes. Using the Debug button is not possible because Excel Crashes.
It seems this problem is caused by a certain Office 365 update because my co-workers who uses Office 365 versions 2208 (last update 10 January/14 February 2023) gets the error from one day to the next. Co-workers who have Office 365 version 2302 last update (28 February 2023) don’t get the error.
First I could not troubleshoot the problem because it was not clear what did cause this error. Finally I could link this error to the UserForm that was shown to the user.
The strange thing was that when I set a breakpoint (F9) just at the line of code where the UserForm was shown and then continued running the code (F5) everything worked without problem!?
A the end by putting a “Timeout of a few seconds with a DoEvents” command in the code just before showing the Userform I could fix the problem. So it seems that Excel, for some reason, “loses the connection” with the Userform a some point. By putting a DoEvent in the code Excel “gets back his breath” an doesn’t lose the connection with the Usefrom?
Although I “fixed” the problem with a workaround I want to understand what’s happening here? Why doesn’t Excel manage this kind of disconnections itself and just Crashes? Why is it that when I put a breakpoint (F9) in the code or “Timeout of few seconds with a DoEvents commend” we don’t get to see the error? Any idea why we get this problem in Office version 2208 and not in Office version 2302?
From my point of view it looks like a Bug/Problem in Excel?