Solved

excel, vba,  subroutines, getting own name

Posted on 2001-09-04
7
454 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction Perhaps more familiar to developers who primarily use VBScript than to developers who tend to work only with Microsoft Office and Visual Basic for Applications (VBA), the Dictionary is a powerful and versatile class, and is useful …
In case Office 2010 has not been deployed in your environment, this article may be quite useful. In our office, we wanted a way to deploy Microsoft Office Professional Plus 2010 through an automated batch file via logon script. This article is docum…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

911 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

20 Experts available now in Live!

Get 1:1 Help Now