Yes, but I can add the module name to the error handler.
Now if I have:
- Module name
- Procedure name
- erl
would I then be able to get the linenumber of the module?
RBS
"Chip Pearson" <chip@cpearson.com> wrote in message
news:uYQQra1MGHA.648@TK2MSFTNGP14.phx.gbl...
> As I said, you can't get the module name. Erl will return the line number
> of the error, assuming that line has a label, otherwise it will return the
> most recent line label.
>
> Sub AAA()
> 10: On Error Resume Next
> 20: Debug.Print 1 / 0
> 30: Debug.Print Err.Source, Err.Number, Err.Description, Erl
> End Sub
>
> displays
>
>
> VBAProject 11 Division by zero 20
>
> in the Immediate window.
>
> --
> Cordially,
> Chip Pearson
> Microsoft MVP - Excel
> Pearson Software Consulting, LLC
> www.cpearson.com
>
>
>
> "RB Smissaert" <bartsmissaert@blueyonder.co.uk> wrote in message
> news:ufFK3V1MGHA.3272@tk2msftngp13.phx.gbl...
>> OK, how about knowing the module name and the erl?
>>
>> RBS
>>
>> "Chip Pearson" <chip@cpearson.com> wrote in message
>> news:eDUgdF1MGHA.2704@TK2MSFTNGP15.phx.gbl...
>>>I don't believe you can get the module name in which the error occurred.
>>>
>>>
>>> --
>>> Cordially,
>>> Chip Pearson
>>> Microsoft MVP - Excel
>>> Pearson Software Consulting, LLC
>>> www.cpearson.com
>>>
>>>
>>> "RB Smissaert" <bartsmissaert@blueyonder.co.uk> wrote in message
>>> news:e8wsUA1MGHA.1032@TK2MSFTNGP11.phx.gbl...
>>>> Is there a way to get the VBE module and module line, given the
>>>> procedure and erl where an error occured?
>>>> The idea is to move straight to the line in the VBE where the error
>>>> occured after handling the error.
>>>> I have numbered the lines per procedure with MZ Tools.
>>>>
>>>> I can move to the line when I have the module and the module line:
>>>>
>>>> With
>>>> ThisWorkbook.VBProject.VBComponents(strModule).CodeModule.CodePane
>>>> .SetSelection lStartLine, 1, lStartLine, 1
>>>> .Show
>>>> End With
>>>>
>>>> I could make my error handler retain the module as well as the
>>>> procedure, but even then I am not sure I could get
>>>> to the module line.
>>>>
>>>>
>>>> RBS
>>>
>>>
>>
>
>
Bookmarks