Module / procedure name detection

B

Bony Pony

Hi all helpful people!

Is there a way to pass the executing procedure name to a variable? I want
to keep a log of the most frequently executed procedures in a workbook so
each time a proc executes, I build a little table with the Module name,
procedure name, user and procedure duration (timed seperately).

All ideas treated equally!!

Best regards and happy Spring to the North!
Bony
 
D

daniel

believe the variable will be lost. one solution is totransfer this data to
hidden cells or sheet
 
J

Jacob Skaria

Did you try writing a separate procedure say WriteLog() to record the
activity to
an external file or a hidden worksheet and call that from end of each proc..

If this post helps click Yes
 
N

Nigel

At the top of each procedure store the procedure name then try calling a log
procedure with the name of the procedure

Dim myProcedure as string

myProcedure = "ThisProcedure"

LogProc(myProcedure)
 
J

Jacob Skaria

1. On top of each procedure place a variable to record the starting time.
2. Below each procedure; call the function to write a log


Sub Procedure1()
dtStart = Now()

' Your code is here
strUser = Environ("Username")
duration = dateDiff("s",dtStart,Now)
Call WriteLog("ModName","Procedure1",strUser,duration)
End Sub


If this post helps click Yes
 
B

Bony Pony

Hi all,
Thanks for the help. I read in a Ron de Bruin post that you cannot detect
the name of a proc from within that proc. So I already used a method like
you all suggested. Many thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top