Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count lines code in workbook
I was wanting to count the lines of code in my workbook which has many
modules, I downloaded the count Loc program but can't seem to get it to run, does anyone have some code to count lines of code in an entire workbook including sheets and modules, possibly skipping comments? thanx |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count lines code in workbook
Use the following code
Public Function CountLines() As Long Dim ovbp As VBProject Dim ovbc As VBComponent Dim lTotLines As Long Set ovbp = ThisWorkbook.VBProject For Each ovbc In ovbp.VBComponents Debug.Print ovbc.Name, ovbc.CodeModule.CountOfLines lTotLines = lTotLines + ovbc.CodeModule.CountOfLines Next ovbc CountLines = lTotLines End Function Make sure that the project References Visual Basic Extensibility library. "Arnold Klapheck" wrote: I was wanting to count the lines of code in my workbook which has many modules, I downloaded the count Loc program but can't seem to get it to run, does anyone have some code to count lines of code in an entire workbook including sheets and modules, possibly skipping comments? thanx |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count lines code in workbook
I cant find it under "Visual Basic Extensibility" or "Extensiblility"
library. Is it under a different name or do I have to import it? thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count lines code in workbook
It is called
Microsoft Visual Basic For Applications Extensibility n.n The numbers at the end are not important. You go to Tools/References and check on the above and hit OK. Alok "Arnold Klapheck" wrote: I cant find it under "Visual Basic Extensibility" or "Extensiblility" library. Is it under a different name or do I have to import it? thanks |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count lines code in workbook
Thanks, that did it works great now.
|
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count lines code in workbook
Please help, what to do???
I tried that which was suggested in this thread and got this error: Run-time error '1004': Programmatic access to Visual Basic Project is not trusted on this line in Alok's code: Set ovbp = ThisWorkbook.VBProject Thanks Laura "Alok" wrote: It is called Microsoft Visual Basic For Applications Extensibility n.n The numbers at the end are not important. You go to Tools/References and check on the above and hit OK. Alok "Arnold Klapheck" wrote: I cant find it under "Visual Basic Extensibility" or "Extensiblility" library. Is it under a different name or do I have to import it? thanks |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count lines code in workbook
xl2002+ offers the user more security.
There's an option under: Tools|Macro|Security|Trusted Publishers Check "trust access to Visual Basic Project" This setting is a user-by-user setting. Your code can't change it. laura_in_abq wrote: Please help, what to do??? I tried that which was suggested in this thread and got this error: Run-time error '1004': Programmatic access to Visual Basic Project is not trusted on this line in Alok's code: Set ovbp = ThisWorkbook.VBProject Thanks Laura "Alok" wrote: It is called Microsoft Visual Basic For Applications Extensibility n.n The numbers at the end are not important. You go to Tools/References and check on the above and hit OK. Alok "Arnold Klapheck" wrote: I cant find it under "Visual Basic Extensibility" or "Extensiblility" library. Is it under a different name or do I have to import it? thanks -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how i can count the dicontineued lines according to category wise | Excel Worksheet Functions | |||
How to count grayed out lines in excel | Excel Discussion (Misc queries) | |||
How to count lines in excel without selecting them | Excel Discussion (Misc queries) | |||
Code to write out all lines of code | Excel Programming | |||
how to display the count of lines found by autofilter? | Excel Discussion (Misc queries) |