how i can get the volume,weight, density by API for a part

Dear friends

i am using macro and API , to draw a part but at the last i want to get the volume and weight of that part ,,, but it doesn't working ,,

please if you konw help me

i used this for volume ex. "


Dim instance As IMassProperty
Dim value As Double

value = instance.Volume

SolidworksApi macros