T
TomS
Hi,
I have a function in Word-VBA with error handler writing some info to log
file. There are strange errors occuring from time to time which I can't
trace. It would be very helpful for me to have information about line in
which error has occured. Is this possible?
For example:
sub foo()
on error goto ErrorHandler
'some code here
exit sub
ErrorHandler:
ErrNumber = Err.Number
ErrDesc = Err.Description
LineNumber = ???
AddToLog "ERROR:foo:" & LineNumber & ":" & ErrNumber & " " & ErrDesc
'resume or resume next - doesn't matter now...
end sub
I don't want to examine my specific function, I just would like to now in
general, if it is possible to read line number in which last error
occured.
Regards,
Tomek
I have a function in Word-VBA with error handler writing some info to log
file. There are strange errors occuring from time to time which I can't
trace. It would be very helpful for me to have information about line in
which error has occured. Is this possible?
For example:
sub foo()
on error goto ErrorHandler
'some code here
exit sub
ErrorHandler:
ErrNumber = Err.Number
ErrDesc = Err.Description
LineNumber = ???
AddToLog "ERROR:foo:" & LineNumber & ":" & ErrNumber & " " & ErrDesc
'resume or resume next - doesn't matter now...
end sub
I don't want to examine my specific function, I just would like to now in
general, if it is possible to read line number in which last error
occured.
Regards,
Tomek