Click to See Complete Forum and Search --> : Printing Code - Lines Count


jplenhart
April 8th, 1999, 10:13 AM
Is there an easy to find out the total number of Source Lines of Code in a project.

Thanks

Lothar Haensler
April 8th, 1999, 10:27 AM
you could write an Add-in that iterates over all CodeModule Objects of your project and adds the CountOfLines property of all those modules.
sample:

Dim p As VBComponent
Dim lCount As Long
For Each p In gVBInstance.VBProjects.StartProject.VBComponents
lCount = lCount + p.CodeModule.CountOfLines
Next p
msgBox "Total: " & lCount


the disadvantage: blank lines are counted as source lines and in multline statements (_) all lines are counted.