Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Logging the current sub's name....

Posted on 2000-04-07
3
Medium Priority
?
150 Views
Last Modified: 2010-05-02
Hi,

    I'm sure this comes up all the time. I would like to log errors / information and report the name of the sub / function from which they come. Is there any way to do this implicitely? Basically, I need a call which returns the current sub's name. Can it be done?

Cheers, Nik.
0
Comment
Question by:NikWhitfield
[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
3 Comments
 
LVL 14

Accepted Solution

by:
wsh2 earned 200 total points
ID: 2693373
At run time.. only with Hard coding.. <sigh>.
0
 
LVL 22

Expert Comment

by:ture
ID: 2693420
Nik,

There is no built-in functionality for this.

The way to do this is to declare a global variable and set its value at the beginning of each procedure.

Ture Magnusson
Karlstad, Sweden
0
 
LVL 3

Expert Comment

by:ashunigam
ID: 2693539
Hi Nik
At the start of application open the log file using Open statement .

In each critical procedure<u want log>, use On Error goto ErrHandler

In err handler Use Print # method to log the error along with time etc:


'say number is 1 for LogFile
Exit Function
ErrHandler:
Print #1, Now & ": Function GetValue:" _
& Err.Descripotion

Hope it helps.
0

Featured Post

Independent Software Vendors: 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!

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.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

670 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