how can i do to select a component?

hi!
i want to select all the component of an assembly. these componentsare parts and assemblies, so i have to make out it before.

code:
vChildComp = swComp.GetChildren

For j = 0 To UBound(vChildComp)
Set swChildComp = vChildComp(j)
a = swChildComp.Select3(True, Nothing)
Set c = swChildComp.GetModelDoc
type = c.GetType
If type = 1 Then 'type=1 is a part
c.EditPart 'error 438 Else
c.EditAssembly 'type<>1 is an assembly
End If

but when select a part that is inside of an assembly i have anerror 438 in line c.EditPart that say: 'the object' doesn´tadmite this property or method'.

can anybody help me, please?
thank you so much!
SolidworksApi macros