Macro Change name Link from part to Sub assembly where it used

Hello everyone

I would like to know if it is possible to do with macros this task :

Write code to check  the open main assembly , which is containing sub assemblies , sub assemblies contains parts ... so I need my macro to look on all sub assemblies , if Sub Assembly XX contains Part A  and Part B or more , do nothing , if Sub Assembly XX contains only part A , so open part A drawing , change Name link on title Block to Sub Assembly XX instead of Part A.

Thanks in advance

SolidworksApi/macros