ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Module / procedure name detection (https://www.excelbanter.com/excel-programming/426208-module-procedure-name-detection.html)

Bony Pony[_2_]

Module / procedure name detection
 
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

Daniel

Module / procedure name detection
 
believe the variable will be lost. one solution is totransfer this data to
hidden cells or sheet

"Bony Pony" wrote:

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


Jacob Skaria

Module / procedure name detection
 
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
---------------
Jacob Skaria


"Bony Pony" wrote:

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


Bony Pony[_2_]

Module / procedure name detection
 
Hi,
Thanks. Didn't answer the question though.
Regards,
Bony

"daniel" wrote:

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

"Bony Pony" wrote:

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


Bony Pony[_2_]

Module / procedure name detection
 
Thanks,
Didn't answer the question though.
Regards,
Bony

"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"Bony Pony" wrote:

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


Nigel[_2_]

Module / procedure name detection
 
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)




--

Regards,
Nigel




"Bony Pony" wrote in message
...
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



Jacob Skaria

Module / procedure name detection
 
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
---------------
Jacob Skaria


"Bony Pony" wrote:

Thanks,
Didn't answer the question though.
Regards,
Bony

"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"Bony Pony" wrote:

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


Bony Pony[_2_]

Module / procedure name detection
 
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!

"Nigel" wrote:

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)




--

Regards,
Nigel




"Bony Pony" wrote in message
...
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





All times are GMT +1. The time now is 12:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com