VBA Edit in Loop Context

Hi all

I'm looking for a way to edit all the parts of an assembly in context, I have the code below that allows me to open all the parts of an assembly.
But I can't change it.

Code start:

Set swApp = Application.SldWorks
    
    Set Assembly = swApp.ActiveDoc
    Set myAsy = Assembly

    myCmps = myAsy.GetComponents(False)
    For i = 0 To UBound(myCmps)
        Set myCmp = myCmps(i)
        If (myCmp.GetSuppression = 3) Or (myCmp.GetSuppression = 2) Then
            Set CmpDoc = myCmp.GetModelDoc
           
            Document = CmpDoc.GetPathName
          
                    Set swModel = swApp.ActivateDoc(Document)

Instead of

 Set CmpDoc = myCmp.GetModelDoc
           
            Document = CmpDoc.GetPathName
          
                    Set swModel = swApp.ActivateDoc(Document)

I tried:

myCmp.EditPart

But it doesn't work.
Do you have an idea?

Rather partedit2 right?:
https://help.solidworks.com/2023/english/api/sldworksapi/solidworks.interop.sldworks~solidworks.interop.sldworks.iassemblydoc~editpart2.html?verRedi
I guess you want to edit them in context one by one, not all at the same time (otherwise not possible).

1 Like