raising error from class module to be caught in regular (bas) module
I ran into this while working on http://www.vbforums.com/showthread.php?t=350844. Basically, I was making a call to a pulic function in my class module from a regualr module (bas) who's job is to check for the presense of an error in a class local variable and raise a VB error if there is one. The class mod function does not have an error handler as the point is to have VB bubble the error upto the calling function to be trapped in it's error handing.
I just thought this was an interesting point (to me anyhow) as my observations means one of the following is true:
a) VB error messages cannot be moved up the call stack across modules
b) VB error messages cannot be moved up the call stack between class and regular modules
c) a and b
I'm suspecting b, but am curious as you you're observations.
Eric
Re: raising error from class module to be caught in regular (bas) module
I don't think either of a or b is true. VB errors propagate up the call stack until they either reach an error handler or run out of stack.
If you have a class module function called from a standard module and an error handler in the procedure calling the class method then any errors raised from the class method will be handled in the calling procedure in the standard module.
Re: raising error from class module to be caught in regular (bas) module
Yeah penagate is right.
You would have to trap the HRESULT and clear it to stop it moving up the callstack.
THis sounds more like an 'event' in a class that you have not declared WithEvents.