activating the Main Body in early binding works.
Dim partDocument1 As PartDocument
partDocument1 = CATIA.ActiveDocument
Dim part1 As Part
part1 = partDocument1.Part
Dim bodies1 As Bodies = part1.Bodies
Dim body1 As Body = bodies1.Item("Main Body")
part1.InWorkObject = body1
In Late Binding the (Exception de HRESULT : 0x80020003 (DISP_E_MEMBERNOTFOUND)) error is returned
Dim partDocument1 As Object
partDocument1 = CATIA.ActiveDocument
Dim part1 As Object
part1 = partDocument1.Part
Dim bodies1 As Object
bodies1 = part1.Bodies
Dim body1 As Object
body1 = bodies1.Item("Main Body")
part1.InWorkObject = body1
Thank you for your attention
I found the solution here: https://ww3.cad.de/foren/ubb/Forum137/HTML/004604.shtml
Dim partDocument1 As Object
partDocument1 = CATIA.ActiveDocument
Dim part1 As Object
part1 = partDocument1.Part
Dim bodies1 As Object
bodies1 = part1.Bodies
Dim body1 As Object
body1 = bodies1.Item("Main Body")
'part1.InWorkObject = body1 'Not working in Late Binding
part1.[GetType]().InvokeMember("InWorkObject", BindingFlags.SetProperty, Nothing, part1, New Object() {body1})