Displaying each active VBA component in a worksheet
Sub ShowComponents()
Dim VBP As VBProject
Set VBP = ActiveWorkbook.VBProject
NumComponents = VBP.VBComponents.Count
For i = 1 To NumComponents
Debug.Print VBP.VBComponents(i).name
Select Case VBP.VBComponents(i).Type
Case 1
Debug.Print "Module"
Case 2
Debug.Print "Class Module"
Case 3
Debug.Print "UserForm"
Case 100
Debug.Print "Document Module"
End Select
Debug.Print VBP.VBComponents(i).CodeModule.CountOfLines
Next i
End Sub
Related examples in the same category