+ Reply to Thread
Results 1 to 2 of 2

Is there a "generic" Error Handling method

  1. #1
    Brad K.
    Guest

    Is there a "generic" Error Handling method

    Is there an Error Handling method that can be used in a generic sense? i.e.
    a statement that can be included in any sub. that will handle any error to
    some degree.

    Thanks,
    Brad K

  2. #2
    gocush
    Guest

    RE: Is there a "generic" Error Handling method

    Of course everyone has there own but you could use something like:

    On Error GoTo ErrorHandler

    'Your code

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '' Close and tidy up
    Tidy:

    '' Reset variables
    Set cnn = Nothing
    Set cmd = Nothing
    ActiveSheet.Protect
    Application.EnableEvents= True
    ' etc --- comment out the ones that don't apply
    Exit Sub

    '' - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ErrorHandler:

    MSG ="Error Number: " & Err & _
    Chr(10) & "Error Description: " & Error()

    MsgBox NSG, vbInformation, "ERROR:"
    GoTo Tidy

    End Sub

    "Brad K." wrote:

    > Is there an Error Handling method that can be used in a generic sense? i.e.
    > a statement that can be included in any sub. that will handle any error to
    > some degree.
    >
    > Thanks,
    > Brad K


+ 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