Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    The Netherlands
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Get function or sub name

    Is there a way to obtain the name of the active function or sub in VBA?. This can be very useful in error handling.
    CurrentObjectName gives the name of the module, not the name of the active function or sub!
    Thanks in advance.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Get function or sub name

    I haven't found any way but setting a constant in each routine to hold the name of the particular sub or function and then including a reference to that constant in your error handler.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    The Netherlands
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Get function or sub name

    That was also my solution, but I did not like it. I hoped for a more elegant way to get the function name. Pity....
    Thanks for the effort.

    Bart Stam
    Software developer
    PGGM Zeist

  4. #4
    David Hare-Scott
    Guest

    Re: Get function or sub name

    The eventprocprefix property may help here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •