+ Reply to Thread
Results 1 to 2 of 2

Call a function on error

  1. #1
    Registered User
    Join Date
    03-18-2010
    Location
    NY, NY
    MS-Off Ver
    Excel 2003
    Posts
    4

    Call a function on error

    This is in 2003.

    So, I have a large arsenal of workbooks acting as templates and front-ends to databases. It's gotten to the point where I need to keep an automatic error log. I've created one in the form of an add-in. My plan was to have at the top of my functions I would have something to the likes of:
    On Error Call errCatcher.sendError(...)

    This obviously doesn't work and I don't really want to have to add an in-function error handler in EACH one of my functions that then JUST calls errCatcher.sendError().

    My question is if it's possible to either change how the default error handler handles errors, or if I could create a global error catcher. Or if there's a more efficient option to the ones previously mentioned.

    Thanks.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Call a function on error

    Any error is handled by the active error handler, which may be several levels above the routine where the error occurs.

    So if sub A has an error handler, and A calls B, and B calls C, an error in C is handled in A.

    Bullen et al have an entire chapter on error handling in Professional Excel Development
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1