Uncaptured Exits
If a VBA procedure exits without reaching a ProfVBAProcEnd statement it will not show in the Profiling Report. The time taken by an uncaptured exit procedure is accumulated into the procedure that it exits to.
The most frequent cause of uncaptured exits is a higher-level error handler:
Sub1 contains an On Error statement to capture VBA errors, and calls Sub2.
Sub2 calls Sub3
Sub3 calls Sub4 and then causes a divide by zero error after the Sub4 call. This error passes control directly to the error handler in Sub1, bypassing the execution of the ProfVBAProcEnd calls in both sub 3 and sub2.
The Profiling Report therefore will not show the time taken by Sub2 and Sub3 and it will be accumulated into Sub1.
|