Make sure you've fixed the reference libraries in the macro
Upload your macro here to check.
You can also modify this macro and use: Insert Coordinate System at Center of Mass Example (VBA)
Check these posts too:
Just to take this one step further, I'm trying to source a macro that will locate the centre of mass/gravity of all components within an assembly relative to a specific point (i.e. the assembly origin) and export this information to an excel file. I realise this has been brought up on several other forums but as yet there doesn't seem to be a solution.
Effectively I'm trying to incorporate the parametric capabilities of solidworks to iteratively optimise the structural configuration of a concentric shaft/bearing arrangement. However, at this stage I'd just like to avoid clicking on and recording the position and mass of each component within what is a fairly large and complex assembly.
Thanks in advance.