Summary

Code Snippets

 ' Code Module
Sub Main
     Dim sch As Schematic
     Debug.Clear

     Set sch = Project.Schematics("top")
     process_hierarchy(sch)
End Sub
Function process_hierarchy(s As Schematic)
     Dim ele As Element
     Dim ns As Schematic
     Debug.Print "Schematic = " & s.Name
     For Each ele In s.Elements
          Debug.Print vbTab & "Element = " & ele.Name
          If InStr(ele.Name,"SUBCKT") Then
               nt = Mid(ele.Parameters(2).ValueAsString,2,Len(ele.Parameters(2).ValueAsString)-2)
               If Project.EMStructures.Exists(nt) Then ' this is here because em structures show up as schematics in the .exists call.
                    ' do nothing
               ElseIf Project.Schematics.Exists(nt) Then
                    Set ns = Project.Schematics(nt)
                    process_hierarchy(ns)
               End If
          End If
     Next ele
End Function