Solved

excel, vba,  subroutines, getting own name

Posted on 2001-09-04
7
462 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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 article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

733 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