Is there a way to know what the current procedure-running is? My problem is
equally solved if there's a way to know what the current line of code is
I know this statement
MsgBox Application.VBE.ActiveCodePane.CodeModule.ProcOfLine(vCurrentLine,
vbext_pk_Proc)
This gives me the procedure-name that is on line vCurrentLine in the active
module. (eg. vCurrentLine = 5)
I want to write a general error procedure that gives me the procedure-name
of the procedure that generates the error without explitely giving it
through
On error goto Herror
.
.
.
Exit Sub
Herror:
Err_Log vProcName, vLinenumber
Resume next
End sub
1000:
On Error GoTo ErrHandler:
Debug.Print "Some Code Here"
1100:
Debug.Print "More Code Here"
Err.Raise 1
1200:
Exit Sub
ErrHandler:
Debug.Print Err.Description, Err.Source, Erl
In this example, Erl will return 1100, because 1100 is the last line number
encountered before the error was raised.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com ch...@cpearson.com
"Jos Vens" <jos....@planetinternet.be> wrote in message
news:B8385652.8D9%jos....@planetinternet.be...
sub myfileopensub()
vprocname="fileopen"
code
end sub
sub main()
vprocname="main"
etc.
John
"Jos Vens" <jos....@planetinternet.be> wrote in message
news:B8385652.8D9%jos....@planetinternet.be...
Yes, but that's just what I didn't want to do. I can also pass the
procedurename to my error function that handles it but then I always have to
retype it. If I rename one time the procedurename, I have to change the
variable too.
Wouldn't it be easy if microsoft made something like
Application.VBE.ActiveCodePane..CodeModule.Procedure in which it stored the
current procedurename
Application.VBE.ActiveCodePane.CodeModule.ProcLine in which it stored the
current procedureline in the module
Why is there something like
Application.VBE.ActiveCodePane.CodeModule in which microsoft stores the
current modulename??? And nothing for procedurename and line???
Thanks anyway,
I consider your suggestion
Jos
in article uzI$XQPgBHA.2204@tkmsftngp04, jaf at joh...@my.hotmail.com wrote
on 2001-12-09 21:56:
The Erl method only returns the last label(numeric), not the last line
number. In combination with my general procedure, I can't use it I suppose?
Thanks anyway
Jos Vens
in article eCeHoNEgBHA.2072@tkmsftngp03, Chip Pearson at ch...@cpearson.com