• Send Method Error Trapping (2003 SP2)

    • This topic has 6 replies, 3 voices, and was last updated 17 years ago.
    Author
    Topic
    #449915

    I use VBA (from within Access) to create and send e-mail via Outlook. If the user’s Outlook “message store” is full, an error is generated when the .Send method is executed (see attachment).

    I’ve tried to trap this error to provide a more legible notification to the user (using On Error Goto Send_Error, etc.) but this error doesn’t seem to trigger the trapping routine. Is there another way to trap this error or am I do something wrong trapping it this way?

    Thanks.

    Viewing 0 reply threads
    Author
    Replies
    • #1104312

      If you get an error message such as the one you attached, error handling can’t be active at the moment the error occurs. You wouldn’t get a Debug option if error handling was active.

      • #1104353

        Hans,

        The line of code immediately preceding objMailItem.Send is On Error Goto Send_Error, so I think error handling is active, unless I’m overlooking something fundamental regarding error handling…

        • #1104361

          What is the setting in the Error Trapping section in the General tab of Tools | Options… in the Visual Basic Editor? It should be set to “Break on Unhandled Errors”, not to “Break on All Errors”. If it is set to “Break on Unhandled Error” I don’t think there is any way you can trap the built-in error message.

          • #1104583

            Hans,

            Yes, it is set to “Break on Unhandled Errors”. So I guess it can’t be trapped… (Does the huge negative error number indicate that it’s a “built-in” error?)

            Thanks for your help.

            • #1104586

              That the error number is negative doesn’t mean much. Programmers are free to choose the error numbers reported by their application.

            • #1104623

              Without seeing your code, this is just a guess. Could this be the second time that error handler is supposed to be called? If an error handler is called and then execution continues without resetting the error handler, it will not be called the second time. To reset error handling, use one of the Resume statements rather than, for example, a GoTo statement.

    Viewing 0 reply threads
    Reply To: Send Method Error Trapping (2003 SP2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: