Well... There is no direct way to do this. However, there is an indirect way that
might work. Assuming you are using this for error handling/logging:
-
1:
-
-
Dim cllProc As String
-
-
cllProc = Me.Module.Procofline(Erl, vbext_pk_Proc)
You might need to add a reference to the VBA Extensibility library. This would be Microsoft Visual Basic for Applications Extensibility 5.3 (or newer version number).
This will return a string with the name of the current procedure that throws an error. The Procofline property pertains to the VBIDE.Module or Access.Module object, takes two arguments: a valid line number in the procedure, and the type of procedure... The Erl() function is the undocumented Error Line function which has a few bugs, hence the 1: label placed above the variable declaration. The Erl() function isn't too specific at times, when an error does occur, it chooses the first available line label ABOVE where the error occurred, means that if there are no line labels, it returns 0, which can affect our ProcOfLine property.
Have I made this clear as mud, or is it somewhat understandable? :-)
Regards,
Scott
p.s. Unfortunately VBA doesn't provide what VB.NET does: System.Reflection.MethodBase.GetCurrentMethod.Name ()