?
Solved

excel, vba,  subroutines, getting own name

Posted on 2001-09-04
7
Medium Priority
?
467 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 6

Expert Comment

by:xSinbad
ID: 6455352
Do you mean 'File' name or Sub name?

file name - Application.GetOpenFilename
0
 
LVL 22

Expert Comment

by:ture
ID: 6456173
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
ID: 6457738
is this for tracing and debugging?
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 6

Expert Comment

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

Author Comment

by:hank1
ID: 6459116
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 200 total points
ID: 6459520
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
ID: 6460852
Surprised this isn't 'native'.  Thanks for the help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

770 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