I am trying to get this code to work but I seem to have something missing and I can't figure it out. I am trying to check it in the immediate window of the Visual Basic Editor and I keep getting a compiling error. I use the TestError (5,0) as my test.
Thanks
Ian
Thanks
Ian
Code:
Sub TestError(intValue1 As Integer, intValue2 As Integer)
On Error GoTo HandleError
'declare variable to store result
Dim intResult As Integer
'calculate result by dividing first value by second value
intResult = intValue1 / intValue2
Exit Sub
HandleError:
MsgBox "Error has occurred in your application: " & Err.Description
Exit Sub
End Sub