Solved

excel, vba,  subroutines, getting own name

Posted on 2001-09-04
7
450 Views
Last Modified: 2012-05-04
vba rookie, xl2000

Is there a way for a currently executing
subroutine to obtain its own name?, file name?,
file line number?

0
Comment
Question by:hank1
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 6

Expert Comment

by:xSinbad
Comment Utility
Do you mean 'File' name or Sub name?

file name - Application.GetOpenFilename
0
 
LVL 22

Expert Comment

by:ture
Comment Utility
hank1,

Name of the workbook containing the currently executing procedure:

  x = ThisWorkbook.Name


Name of the currently executing procedure:

  Sorry - I don't know. You could make it a habit to set a variable at the beginning of the procedure...
  This variable could be declared at the top of the module so that you don't have to declare it in every
  procedure.

  Dim ProcName As String

  Sub DoStuff()
    ProcName = "DoStuff"
    ...
    ...
  End Sub

  Sub DoOtherThings()
    ProcName = "DoOtherThings"
    ...
    ...
  End Sub


Line number of currently executing line:

  I have no idea. Sorry.


Ture Magnusson
Karlstad, Sweden
0
 
LVL 44

Expert Comment

by:bruintje
Comment Utility
is this for tracing and debugging?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 6

Expert Comment

by:xSinbad
Comment Utility
Can you enlighten us a little more on what you are trying to do?
0
 
LVL 1

Author Comment

by:hank1
Comment Utility
Thanks.

Need the information for support.  All our code
contains a log facility to record a trace,
file name, line number and release information.

Don't want a "core dump" here.  Often just the file
name and line number (placed down in the corner of an
error message) is all we require from the user.




0
 
LVL 44

Accepted Solution

by:
bruintje earned 50 total points
Comment Utility
all right there are a load of paid programs on the market doing this, a freeware program i know of can be downloaded here
http://nonags.online.ru/prog32.html
look for the " Postmortem Toolkit for VB 6 " and have fun, documentation included

HTH:O)Bruintje
0
 
LVL 1

Author Comment

by:hank1
Comment Utility
Surprised this isn't 'native'.  Thanks for the help.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now