Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Get name of procedure that is running?

Is there a command to get the name of the running procedure?
The reason: My main procedure calls 10 smaller procedures; If any of those
10 procedures throws an error, i want to continue processing and i don't only
want to capture the error code and description, but get the name of the
procedure where the error occured.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Get name of procedure that is running?

Headly;

Maybe the simplst of things you can do within each of these small procedures
is run an error handler with a messagebox !!!

--
Regards;
Mark Rosenkrantz
--
Spreadsheet Solutions
Uithoorn
Netherlands
--
E:
W:
www.spreadsheetsolutions.nl
--

"headly" wrote in message
...
Is there a command to get the name of the running procedure?
The reason: My main procedure calls 10 smaller procedures; If any of those
10 procedures throws an error, i want to continue processing and i don't
only
want to capture the error code and description, but get the name of the
procedure where the error occured.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Get name of procedure that is running?

I don't know of an automatic way of doing this.
I use a global stack array and line numbers: at the start of each procedure
I add the procedure name into the stack array and and at the end of each
procedure I remove the procedure name. This allows my error handler to
display the call stack, the name of the procedure and the line number. I
also have a debug option in the stack handler that shows the procedure calls
and levels in the Immediate window.

In general this approach seems to work well with a protected XLA.

Charles
___________________________________
The Excel Calculation Site
http://www.decisionmodels.com

"headly" wrote in message
...
Is there a command to get the name of the running procedure?
The reason: My main procedure calls 10 smaller procedures; If any of those
10 procedures throws an error, i want to continue processing and i don't
only
want to capture the error code and description, but get the name of the
procedure where the error occured.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Helpful, can you clarify "logging to register the process"

Not clear on what you mean by "logging to register the processes"; Does each
procedure write to a sheet or metadata that it ran?

"Patrick Molloy" wrote:

add a new class, call it say clError , then process has an error handler that
(1) creates a new clError object and save it to a collection.
The clError should contain the details - process name, error number, error
message and whatever. the collection should be PUBLIC

at the end of the process, you can interrate through the collection or error
objects to see what happened.

This isn't normal imho. Almost all the investment banks that I work for use
logging extensively to register the processes. This makes it easy (readign
the text file) to see where the process is, and to review any errors





"headly" wrote:

The message box stops execution and requires the user to respond; if the
process generates 100 errors I can't have someone babysit it for 30-60
minutes and click OK to each message, I just want to continue processing and
log errors.

"Spreadsheet Solutions" wrote:

Headly;

Maybe the simplst of things you can do within each of these small procedures
is run an error handler with a messagebox !!!

--
Regards;
Mark Rosenkrantz
--
Spreadsheet Solutions
Uithoorn
Netherlands
--
E:
W:
www.spreadsheetsolutions.nl
--

"headly" wrote in message
...
Is there a command to get the name of the running procedure?
The reason: My main procedure calls 10 smaller procedures; If any of those
10 procedures throws an error, i want to continue processing and i don't
only
want to capture the error code and description, but get the name of the
procedure where the error occured.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Helpful, can you clarify "logging to register the process"

you create a text file called something like
LogFile_20091013.txt
you then have a sub that writes to this file eg
Sub WriteLog(text)
LogTextFile.Write text
End Sub

the logtextfile sub would open a textstream object to the file, creating it
if it doesn't exist, and writes the text to it.

The useful thing here is that you can insert the writelog log messages
anywhere in the code...so

WriteLog "Starting main batch..."

WriteLog "Main batch error..."
WriteLog "processbname:" & err.description





"headly" wrote:

Not clear on what you mean by "logging to register the processes"; Does each
procedure write to a sheet or metadata that it ran?

"Patrick Molloy" wrote:

add a new class, call it say clError , then process has an error handler that
(1) creates a new clError object and save it to a collection.
The clError should contain the details - process name, error number, error
message and whatever. the collection should be PUBLIC

at the end of the process, you can interrate through the collection or error
objects to see what happened.

This isn't normal imho. Almost all the investment banks that I work for use
logging extensively to register the processes. This makes it easy (readign
the text file) to see where the process is, and to review any errors





"headly" wrote:

The message box stops execution and requires the user to respond; if the
process generates 100 errors I can't have someone babysit it for 30-60
minutes and click OK to each message, I just want to continue processing and
log errors.

"Spreadsheet Solutions" wrote:

Headly;

Maybe the simplst of things you can do within each of these small procedures
is run an error handler with a messagebox !!!

--
Regards;
Mark Rosenkrantz
--
Spreadsheet Solutions
Uithoorn
Netherlands
--
E:
W:
www.spreadsheetsolutions.nl
--

"headly" wrote in message
...
Is there a command to get the name of the running procedure?
The reason: My main procedure calls 10 smaller procedures; If any of those
10 procedures throws an error, i want to continue processing and i don't
only
want to capture the error code and description, but get the name of the
procedure where the error occured.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Get name of procedure that is running?

Log to a text file like this. strText will hold all the relevant details to
do with the error, such as the name of the procedure,
Err.Description and the error line number, Erl.

Sub LogData(strFilePath As String, strText As String)

Dim hFile As Long

On Error GoTo ERROROUT

hFile = FreeFile
Open strFilePath For Append As #hFile
Print #hFile, strText
Close hFile

ERROROUT:

If hFile 0 Then
Close hFile
End If

End Sub


RBS



"headly" wrote in message
...
Is there a command to get the name of the running procedure?
The reason: My main procedure calls 10 smaller procedures; If any of those
10 procedures throws an error, i want to continue processing and i don't
only
want to capture the error code and description, but get the name of the
procedure where the error occured.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Get name of procedure that is running?

Here's what I use:

http://www.aspfree.com/c/a/Microsoft...VBA-Details/1/

FYI, Application.VBE.ActiveCodePane.CodeModule will give you the name
of the module containing the procedure where the error occured.

--JP

On Oct 13, 9:13*am, headly wrote:
Is there a command to get the name of the running procedure?
The reason: My main procedure calls 10 smaller procedures; If any of those
10 procedures throws an error, i want to continue processing and i don't only
want to capture the error code and description, but get the name of the
procedure where the error occured.


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Get name of procedure that is running?

Sounds interesting, but where do you download that code from?

RBS


"JP" wrote in message
...
Here's what I use:

http://www.aspfree.com/c/a/Microsoft...VBA-Details/1/

FYI, Application.VBE.ActiveCodePane.CodeModule will give you the name
of the module containing the procedure where the error occured.

--JP

On Oct 13, 9:13 am, headly wrote:
Is there a command to get the name of the running procedure?
The reason: My main procedure calls 10 smaller procedures; If any of those
10 procedures throws an error, i want to continue processing and i don't
only
want to capture the error code and description, but get the name of the
procedure where the error occured.


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Get name of procedure that is running?

Unfortunately the source code is not provided completely. You'll need
to read that page and apply the concepts to write most of it. I could
post what I wrote, if anyone wants to see it.

--JP

On Oct 13, 5:01*pm, "RB Smissaert"
wrote:
Sounds interesting, but where do you download that code from?

RBS

"JP" wrote in message

...
Here's what I use:

http://www.aspfree.com/c/a/Microsoft...VBA-Details/1/

FYI, Application.VBE.ActiveCodePane.CodeModule will give you the name
of the module containing the procedure where the error occured.

--JP

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Get name of procedure that is running?

Yes, thanks, would be interesting.

RBS


"JP" wrote in message
...
Unfortunately the source code is not provided completely. You'll need
to read that page and apply the concepts to write most of it. I could
post what I wrote, if anyone wants to see it.

--JP

On Oct 13, 5:01 pm, "RB Smissaert"
wrote:
Sounds interesting, but where do you download that code from?

RBS

"JP" wrote in message

...
Here's what I use:

http://www.aspfree.com/c/a/Microsoft...VBA-Details/1/

FYI, Application.VBE.ActiveCodePane.CodeModule will give you the name
of the module containing the procedure where the error occured.

--JP




  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 806
Default Get name of procedure that is running?

Hello,

I suggest to log some info and to increase or to decrease the amount
of information as far as you need:
http://log4vba.everage.ca/

Advantage: With the right level of detail you will even know (even
long after somebody has run your app) what your users did when.
Disadvantage: Might slow down your app (but - hey, you can switch it
off/on whenever you feel the need).

Regards,
Bernd
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running a Sub Procedure every 5 seconds Alan Beban[_2_] Excel Programming 2 October 12th 07 10:05 PM
Running Ontime's procedure while another function is running? Enter The Excel Programming 1 May 11th 07 05:58 AM
How to Dim the contents of a variable in running procedure? [email protected] Excel Discussion (Misc queries) 5 May 1st 07 12:34 AM
Procedure not running automatically... kartune85[_13_] Excel Programming 1 June 26th 06 03:21 AM
Running Userform Procedure Nigel Excel Programming 1 August 19th 05 07:16 AM


All times are GMT +1. The time now is 02:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"