Friday, June 8, 2012

Error Trapping:-

Trapping errors are important as users can do marvelous things to mess up you macros. Here you can use either of these 2 statements.
         - On Error Resume Next   OR
         - On Error Goto ErrorTrap1
            ... more lines of code
            ErrorTrap1:
            ... more code (what to do if there is an error)
The first statement will allow the macro to continue the next line of code upon hitting an error but the second statement will run an alternative code should there be an error.

No comments: