macro subassy save as part and replace in the main assy

Hi,

I have a main assembly wich has more than thounsand subassemblies (wich could contain parts or assemblies, doesn't matter).

I would like to have a macro who, for every subassembly from the main assembly do "Save as Part" (named the same), then Replace in the main assembly every subassembly with the part just made. What do you think, it is possible?

I've attached a video, not the best quality.

Thanks.

SolidworksApi macros