keep track of last code line before error
Hi Peter,
I was trying to avoid the line numbers as it makes the code look a bit
messy.
I suppose there is no way round it.
The other thing is how would it handle the different modules?
I understand line numbers start from zero at every new module.
This is now MZ tools does it anyhow.
So how would you know what module was run last before the handled error
occured?
I think in practice this normally will be very obvious, but just in case it
wasn't.
RBS
"Peter T" <peter_t@discussions wrote in message
...
Hi Bart,
Need Line numbers but no need to increment a variable.
Sub test()
On Error GoTo errH
10 x = x + 1
20 x = x + 2
30 x = x / 0
40 x = x + 1
x = x + 1
x = x / 0
50 x = x + 1
Exit Sub
60 x = 10
Exit Sub
errH:
If Erl = 30 Then
Resume Next
Else
MsgBox Erl
GoTo 60
End If
End Sub
Regards,
Peter T
"RB Smissaert" wrote in message
...
Is it possible somehow to keep track of the last line of code that was
run
before a handled error occured without
adding line numbers or without adding a public variable that gets
incremented before every line?
I was thinking of perhaps a class handling VBE events, but I think I will
need the public variable.
I am not keen to add line numbers.
RBS
|