Solved

excel, vba,  subroutines, getting own name

Posted on 2001-09-04
7
460 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
My experience with Windows 10 over a one year period and suggestions for smooth operation
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

839 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