-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Right now, there is a known limitation that Ending code execution of a TimerProc (through the debugger + Stop button, or the End keyword) will crash Excel. This is because stopping the TimerProc from returning means WinAPI never gets a response from Excel, and there is no way of catching the Error with VBA code as End destroys everything.
Now RubberDuck uses a clever method of invoking methods in their test explorer which circumvents this issue
However this cannot be implemented directly in VBA since even if the method of invoking catches End statements, there needs to be some code to handle that caught error, and if it's VBA then it will be destroyed - https://chat.stackexchange.com/transcript/message/54875311#54875311
There are 3 solutions I can think of:
-
Use the RD method of invocation, but write some assembler to convert from WinAPI timer procs and whatever signature the invocation requires, and this way VBA is avoided entirely
-
Create an addin in C# or VB6 perhaps which does what RD does natively and is unaffected by the code termination
-
Write the error handling stuff in native assembler and forward the function call through that