Displaying each active VBA component in a worksheet : VBE « Application « VBA / Excel / Access / Word






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

1.Show selected VB component's name
2.Find the code pane
3.Find the selected component in VBIDE
4.Find code object
5.Get VB project name
6.Get active project name
7.Find user form
8.Find worksheet code module
9.Clear Immediate window through VBE