Link to home
Start Free TrialLog in
Avatar of Milewskp
MilewskpFlag for Canada

asked on

How to trap VBA errors without error handlers

I would like to trap all VBE errors (even when a procedure has no error handler). I didn't even know this was possible until I read this webpage: http://www.everythingaccess.com/vbwatchdog/howitworks.htm
SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Milewskp

ASKER

Thanks Jim,
That's useful information. What I was looking for, though, is what they have in vbwathdog (as described @ http://www.everythingaccess.com/vbwatchdog/howitworks.htm).

However, your answer made me realize that such a feature is useless without being able to access the callstack, which you've already told me is not a feature of VBA: https://www.experts-exchange.com/questions/26621434/How-to-access-the-VBA-callstack.html?cid=1575&anchorAnswerId=34156185#a34156185)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@Milewskp,
You really should be asking Wayne these questions.  However, before you do ... it's all pretty well spelled in the help file for Watchdog, was well as additional information on the 'native code' concept.

This posted above:

"What their doing is short circuiting the error handling and allowing their class to handle errors before the normal VBA error logic takes place. "

... pretty much sums it  up.  As a Beta tester on Watchdog, may I suggest 'using' the product as opposed to re-inventing what was done, if that is what you are hoping to do ... because it is *not trivial*.

mx
Hi mx,
<it's all pretty well spelled in the help file for Watchdog>
I looked, but couldn't find it.
Hi mx,
It seems to me that the demo and the link tells us what it does, but I'm interested in how, as Jim says, they short circuit the error handling and allow their class to handle errors before the normal VBA error logic takes place.  Am I missing something?
<<It seems to me that the demo and the link tells us what it does, but I'm interested in how, as Jim says, they short circuit the error handling and allow their class to handle errors before the normal VBA error logic takes place.  Am I missing something? >>

  They are not going to tell you that.  As MX said, it's not a trival task and if they told you, they'd be giving away trade secrets.  You might be able to glean something from the class module (I haven't looked at it yet), but I would bet you would not get everything you need to know.

 Let's face it, they have hundreds if not thousands of hours in this thing so their not going to spell out in detail how it works.   Just as Microsoft has never fully documented JET.

  If you want to know, you'll have to figure it out for yourself just as they did.

JimD.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
"Im I missing something?"
Yes.  What you are missing is ... it's proprietary.  

My suggestion:  Use the app to build a truly global error handler.  I'm incorporating it into my apps, as I indicated in the testimonial.  I've waited for years for a real global error handler.

mx
Thanks everyone for your input; I'll split the points.
Thanks everyone.