Use Assembly Expert value in macro

I need to have a value of total of different parts and sub-assemblies on an assembly.

I know the value is easy to find from the Assembly Expert, but I haven't found anywhere how to extract the value.

Anyone knows how to extract that from the Assembly Expert and use it into a macro?

Thanks

SolidworksApi macros