D
dchendrickson
The amount of code in my project has grown to the point
that I would like my error handling message to return not
only the error description and name of the procedure, but
also the name of the module in which the procedure
resides.
I could go back through my code and hardcode the module
name into each procedure's error handler, but there must
be a simple way to capture the "current module" and
reference the currentmodule.name property. I realize I
will have to add the code statement into each module -
which is nearly as much work as hardcoding - but I would
like to know how to approach this anyway.
I tried using a version of the example in HELP for the
CodeContextObject property, but it caused errors. So I
must not understand its use.
I would like to do the following:
basMyModule....
public function MyProdure()
on error goto err_MyProcedure
..... code...
exit_MyProcedure:
exit function
err_MyProcedure:
Dim msgErr As Integer
msgErr = MsgBox("Error Number: " & Err.Number & _
" - " & Err.Description,vbExclamation, _
"MyProcedure() in " & currentmodule.name)
Resume Exit_MyProcedure
End Function
Thanks for your help.
that I would like my error handling message to return not
only the error description and name of the procedure, but
also the name of the module in which the procedure
resides.
I could go back through my code and hardcode the module
name into each procedure's error handler, but there must
be a simple way to capture the "current module" and
reference the currentmodule.name property. I realize I
will have to add the code statement into each module -
which is nearly as much work as hardcoding - but I would
like to know how to approach this anyway.
I tried using a version of the example in HELP for the
CodeContextObject property, but it caused errors. So I
must not understand its use.
I would like to do the following:
basMyModule....
public function MyProdure()
on error goto err_MyProcedure
..... code...
exit_MyProcedure:
exit function
err_MyProcedure:
Dim msgErr As Integer
msgErr = MsgBox("Error Number: " & Err.Number & _
" - " & Err.Description,vbExclamation, _
"MyProcedure() in " & currentmodule.name)
Resume Exit_MyProcedure
End Function
Thanks for your help.