Reputation:
As far as I can tell, there is nothing in VBA that tells you what line you are on or at what line an error has occurred. Is there some way to get the line number like there is in Visual Basic, ie
Dim CurrentStack As System.Diagnostics.StackTrace
lineNo = CurrentStack.GetFrame(0).GetFileLineNumber
How can one adapt this code for VBA?
Upvotes: 2
Views: 1127
Reputation: 34045
erl
will give you the error line number but only if you have added line numbers to your code, either manually or using an add-in like MZ Tools.
Upvotes: 4