drom
Active Member
- Joined
- Mar 20, 2005
- Messages
- 491
- Office Version
-
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
Thanks Ina Advance!
if I want to count the number of lines my "ThisWorkbook" sheets module or any other Sheets module has...
I can use the following macro:
But is there any other way of doing this rather than the prior one?
Kind of:
Thanks!
if I want to count the number of lines my "ThisWorkbook" sheets module or any other Sheets module has...
I can use the following macro:
Rich (BB code):
Sub Count_CLS_Lines()
On Error Resume Next
Dim WkbName As String: WkbName = "Z:\MrExcel\Eg_20080309.xlsm"
Dim VBComp As VBIDE.VBComponent
Dim VBComps As VBIDE.VBComponents: Set VBComps = Workbooks(WkbName).VBProject.VBComponents
For Each VBComp In VBComps 'For X= ...
Select Case VBComp.Type
Case vbext_ct_Document: 'VBComps.Remove VBComp '100:"Document"
With VBComp.CodeModule
If .CountOfLines > 0 Then
Debug.Print .CountOfLines ''???????????????????????????
End If
End With
End Select
Next VBComp
beep
End Sub
But is there any other way of doing this rather than the prior one?
Kind of:
Rich (BB code):
Debug.Print ThisWorkbook.VBProject.VBComponents("Sheet1").CountOfLines
Debug.Print ThisWorkbook.VBProject.VBComponents("thisWorkbook").CountOfLines
Thanks!