The
is really great for picking up Bounds and other errors. It tells which sub, function, etc the error occurred in. Far far better than the gpf's we used to get.
However if the error occurs inside a long Sub, ... or deep within macros, or a long loop, or ... it can still be difficult to pin down. Not nearly as hard as before the Debug Display but still ...
Anyway here's a handy tip for further narrowing down the vexious culprit: At various points in the suspect code put line numbers (or labels), then when the error msg comes up it will say " ## Error after Line 1000" (or whatever thelast label was.
Now when the errror trips, it will say "## Error ocurred after "After_Complicated" or "after 1300" or whatever Mile Marker that has been inserted set. Rather than just "After Foo".
================================
"You cannot depend on your eyes
when your imagination
is out of focus."
Mark Twain
================================
Code:
#Debug Display On '<<<<<<<<<<<<<<< Remember to turn off for production code
However if the error occurs inside a long Sub, ... or deep within macros, or a long loop, or ... it can still be difficult to pin down. Not nearly as hard as before the Debug Display but still ...
Anyway here's a handy tip for further narrowing down the vexious culprit: At various points in the suspect code put line numbers (or labels), then when the error msg comes up it will say " ## Error after Line 1000" (or whatever thelast label was.
Code:
Function Foo() As Long 'tip o the derby to 1000: 'Mile marker Id Call Complicated_Sub_Full_of_Macros After_Complicated: 'Mile marker Id Call Macro After_Macro: 'Mile marker Id Call Another_Sub 1300: 'Mile marker Id Call Macro 1400: 'Mile marker Id '... End Function
================================
"You cannot depend on your eyes
when your imagination
is out of focus."
Mark Twain
================================
Comment