Detecing Current Module via Code

  • Thread starter Thread starter David C. Holley
  • Start date Start date
D

David C. Holley

Is there a way that I can detect the current SUB/FUNCTION that is being
executed other than hard-coding the name of the SUB/FUNCTION?
 
Far be it from MS to provide something that would eliminate typing the
name of the module and sub/function with a single line of code or two.
 
TANSTAAFL. Microsoft would probably have to do it "automagically" in
much the same way as you would do it manually - i.e. saving the name
of the Module and Function in a Global on entry to the function. The
fact that you would not see the code would not prevent it being
executed _for_ _every_ _function_ _call_. This would add a
considerable amount of overhead to every function for an occasional,
marginal, benefit.

Far be it from MS to provide something that would eliminate typing the
name of the module and sub/function with a single line of code or two.

Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
I just find it difficult to understand why something like that would be
so difficult. I'd think that it be quite simple to grab the name of the
SUB/FUNCTION and stick it somewhere since afterall a SUB/FUNCTION has to
be called explicity.
 
It is certainly a feature that I would have used a lot, for error-logging.
Whatever the reason, though, the feature is not available, and it is, I
think, highly unlikely that it will ever be implemented in VBA now.
 
Back
Top