user1452705
user1452705

Reputation:

Log what line error occurs: vba

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

Answers (1)

Rory
Rory

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

Related Questions