If I understand correctly, do you want to break down all the subassemblies?
Try this:
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swAssy As SldWorks.AssemblyDoc
Dim swComp As SldWorks.Component2
Dim swCompModel As SldWorks.ModelDoc2
Dim vComp As Variant
Dim blnDone As Boolean
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swAssy = swModel
blnDone = False
While Not blnDone
blnDone = True
For Each vComp In swAssy.GetComponents(False)
Set swComp = vComp
Set swCompModel = swComp.GetModelDoc2
If Not swCompModel Is Nothing Then
If swCompModel.GetType = swDocASSEMBLY Then
swComp.Select4 False, Nothing, False
swAssy.DissolveSubAssembly
blnDone = False
Exit For
End If
End If
Next
Wend
End Sub