Transforming a sub-assembly into a part (.sldprt) within the treated assembly

Experts,
I want to transform automatically a sub-assembly into a part (.sldprt) within the treated assembly without manualy saving the sub-assembly into a part file, then reinsert it in the assembly.
Can you help me and thank you in advance.

SolidworksApi macros