If you put the expression:
Application.SldWorks.GetOpenDocument("YOURPARTNAMEHERE.SLDPRT").Extension.CreateMassProperty.Mass
in an equation, it will return the mass of all existing bodies in the active configuration of the file YOURPARTNAMEHERE.SLDPRT. The part must be open in SolidWorks in its own window, although not necessarily the active window. Otherwise, according to the help, the line "may not work as expected". SW will attempt to evaluate the equation if you rebuild an assembly or drawing that references this part even if the part is not open in its own window. If you are using the equation to drive dimensions etc. then you may get some undesirable behavior. If you want the equation to work correctly no matter the context, you would need to replace the line above with:
Iif(False, CallByName(Application.SldWorks.GetOpenDocument("YOURPARTNAMEHERE.SLDPRT"),"Visible", vbLet, True), Application.SldWorks.GetOpenDocument("YOURPARTNAMEHERE.SLDPRT").Extension.CreateMassProperty.Mass)
This line will open and activate the document in its own window if it does not already have its own window. If it does have its own window, the document will not be activated.