C
CrazyAccessProgrammer
I'm trying to centralize error messages using a function for displaying error
messages. I'd like to pass the name of the procedure where the error occurs
to this function that will display error messages so that the message box can
include the name of the procedure where the error occured.
I've tried using the ProcOfLine method but that method requires you to use
an argument where you explicitly state a line number in the VBA editor and
whereever that line number happens to fall is the name of the procedure that
ProcOfLine method will return.
That would work except that I'm constantly adding code to modules and as
such it would create more work constantly reviewing all the Subs and
Functions ProcOfLine calls to see if they still have the correct line number
argument every time I add code to the module.
What I really need to know is if there's a simple VBA function that simply
returns the string of the name of the procedure from which it's called.
In my imaginary VBA world it would look something like this:
Sub MySubThatDoesSomething
Dim MyProcName as string
MyProcName = SomeVBAFunction
(SomeVBAFunction would then set my string variable MyProcName to
'MySubThatDoesSomething')
End Sub
God I hope this makes sense to someone out there.
messages. I'd like to pass the name of the procedure where the error occurs
to this function that will display error messages so that the message box can
include the name of the procedure where the error occured.
I've tried using the ProcOfLine method but that method requires you to use
an argument where you explicitly state a line number in the VBA editor and
whereever that line number happens to fall is the name of the procedure that
ProcOfLine method will return.
That would work except that I'm constantly adding code to modules and as
such it would create more work constantly reviewing all the Subs and
Functions ProcOfLine calls to see if they still have the correct line number
argument every time I add code to the module.
What I really need to know is if there's a simple VBA function that simply
returns the string of the name of the procedure from which it's called.
In my imaginary VBA world it would look something like this:
Sub MySubThatDoesSomething
Dim MyProcName as string
MyProcName = SomeVBAFunction
(SomeVBAFunction would then set my string variable MyProcName to
'MySubThatDoesSomething')
End Sub
God I hope this makes sense to someone out there.