VBA Code line numbers

I see many people posting VBA and Sql code with line numbers. What software does this?
DavisroBudget AnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongSoftware Team Lead, ex-Business Systems Analyst , ex-Senior Application EngineerCommented:
expand.jpgwhen you post the comment, click the "code" button, it will make the content as the code snippet

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DavisroBudget AnalystAuthor Commented:

Open in new window

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
That's only here on the site though.  If you really want line numbers in your VBA code, then download MZ Tools (freeware):


 Besides line numbering, it contains a host of other features to help you with your code.

The line numbering comes in handy in that you can have your error procedures use the undocumented VBA.ERL function.  This grabs the line number.  So your error procedure call can look like this:

50    UnexpectedError ModuleName, RoutineName, Version, Err.Number, Err.Description, Err.Source, VBA.Erl

and produce something like this:

An application event was logged:
Msgbox Title:
Packing Labels Ver 46.12 - Unexpected error

The application has encountered an unexpected error.
App Name: Packing Labels    Version: 46.12

Station Name: xxxxx     User Name: xxxxxxxxxx

Module: frm_LabelPrint     Routine: cboTransId_AfterUpdate     Version: 1.1.0

Error Number: 94
Description: Invalid use of Null

Source: PackingLabels      Line number: 20

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.