+ Reply to Thread
Results 1 to 4 of 4

On Error Goto (Global Error Handling)

  1. #1
    mpeplow
    Guest

    On Error Goto (Global Error Handling)

    If know by adding the statement

    On Error Goto {Error Handling}

    will tell the sub routine to goto the specified line of code.

    I was wondering if there was anyway to add a single global command to handle all errors within a project. Such as "If any Error within Project call ErrorSub"

  2. #2
    Forum Moderator Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,881
    You could create a module in your workbook, and in it write a Sub procedure that will handle your errors.

    Your code in Sheet1 might look like this:
    Please Login or Register  to view this content.
    The 'Call myErrorHandler' line will call the Sub from your module. The code in your module will resemble:
    Please Login or Register  to view this content.

  3. #3
    mpeplow
    Guest
    thats how I have it set up at moment, what I'm wondering, is there a way to add a single global statement to the code somewhere, so I do not have to write the code that calls the error sub routine in every single subroutine?

  4. #4
    Forum Moderator Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,881
    My initial answer would be "no, there is no one line of code that will do this for you."

    Perhaps one of the stronger VBA coders in the forum can prove me wrong. (not difficult to do, usually)


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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