Handling Error in form of programing language is vital task. To protect your application from stoping/freezing in midway is important. If you handle the error properly then you will not only successfully execute the application but you can also make user aware of the error which was thrown during the execution.
Lets us take a simple example for error handler:
Sub prTest()
'Error Handler Starts
On Error GoTo Err_PrTest:
Dim rngTest As Range
Dim intTest As Integer
Dim intCounter As Integer
If rngTest(1, 1) = 0 Then
'Do Nothing
End If
Exit_PrTest:
Set rngTest = Nothing
Exit Sub
Err_PrTest:
MsgBox Err.Description
GoTo Exit_PrTest
End Sub
Once this code goes into error below error is thrown to the user:
This blog is about Technology. One ultimate destination for tutorials on programming languages, exploring about complex situations in different programming languages. Also Knowing about most wanted technologies now and in Future. The Major content as of now will be focussed on Excel and Visual Basic for Applications(VBA). Have a happy reading...!!
Monday, January 4, 2010
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
About Me
- Ravindra Singh Yadav
- Hello World!. I am an aspiring blogger, striving towards knowing more about various Technologies and innovating about it. I am full of Energy, Enthusiasm to learn more and more....
No comments:
Post a Comment