How to retrieve procedures ans functions names in VBA ?

A

Aeronav

Good morning,
I am using WIN XP SP2 and Excel 2007
Microsoft explains in kb274680 (in french) how to retrieve procedures and
functions names of projects, but the method uses C++, which I do not have.
Is there a way to do the same thing using VBA, from Excel VBIDE ? I need it
to create more easily a customUI for Excel 2007 Ribbon.
Thanks,
 
B

Bob Phillips

This gets the active procedure name as long as these procs are in the same
module

Sub testGAPM()
Dim mpStartLine As Long
Application.VBE.ActiveCodePane.GetSelection mpStartLine, 0, 0, 0
MsgBox GetActiveProcName(mpStartLine)
End Sub

Function GetActiveProcName(StartLine As Long) As String
GetActiveProcName = Application.VBE.ActiveCodePane. _
CodeModule.ProcOfLine(StartLine, 0)
End Function



--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top