Err object being reset and returning err.number = 0

From: TC (getmyemails2_at_yahoo.com)
Date: 01/20/05


Date: Wed, 19 Jan 2005 22:26:36 -0500

Hello,

I am experiencing an odd and intermittent problem with a COM addin that I've built. I have seen this problem once before in a Word global template.

Imagine code structured like the following pseudo-code:

  Sub Something
      On Error Goto ErrorHandler
      
      ' routine goes here

  ErrorHandler:
      
      If err.number <> 0 then
          ErrorMessage err
      end if
  End Sub

  Sub ErrorMessage(byval objErr as ErrObject)
      msgbox "Error: " & objErr.Number & vbcr & "Description: " & objErr.Description
  End Sub
    
If the above routine causes an error, the message box returned reveals "Error: 0", i.e. no error, but this is not possible because otherwise, the ErrorMessage routine would not be called.

I resolved this once before by passing in the err.number & err.description values as opposed to the err object itself. It was as if the OS was losing its thread to the err object.

Has anyone else experienced this?

Regards,

TC



Relevant Pages

  • Err object being reset and returning err.number = 0
    ... I am experiencing an odd and intermittent problem with a COM addin that I've built. ... Sub Something ... I resolved this once before by passing in the err.number & err.description values as opposed to the err object itself. ...
    (microsoft.public.word.vba.customization)
  • Err object being reset and returning err.number = 0
    ... I am experiencing an odd and intermittent problem with a COM addin that I've built. ... Sub Something ... I resolved this once before by passing in the err.number & err.description values as opposed to the err object itself. ...
    (microsoft.public.word.vba.general)
  • Re: Err object being reset and returning err.number = 0
    ... >I am experiencing an odd and intermittent problem with a COM addin that ... >Sub Something ... >If the above routine causes an error, ... >values as opposed to the err object itself. ...
    (microsoft.public.word.vba.general)
  • Re: Err object being reset and returning err.number = 0
    ... >I am experiencing an odd and intermittent problem with a COM addin that ... >Sub Something ... >If the above routine causes an error, ... >values as opposed to the err object itself. ...
    (microsoft.public.vb.com)
  • Re: Err object being reset and returning err.number = 0
    ... >I am experiencing an odd and intermittent problem with a COM addin that ... >Sub Something ... >If the above routine causes an error, ... >values as opposed to the err object itself. ...
    (microsoft.public.word.vba.customization)