View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How to get the current module name and Sub in VBA?

Nothing built into VBA allows you to do this.

You have to keep track of it yourself.

Chip Pearson has some code that may help you:
http://cpearson.com/excel/InsertProcedureNames.aspx

IIRC, MZTools has this ability, too:
http://www.mztools.com/

ErdincEKaracam wrote:

Dear Sirs,

I want to learn that how to get the current module name and Sub in
VBA?

For example:

In a standard module named as "MPEP" ;

Sub XYZ()
Msgbox "It's an Example"
End Sub

The result should be:
For Module Name: MPEP
and
For Sub Name: XYZ

How we can do this with VBA?

Thanks inadvance.

Erdinç.


--

Dave Peterson