AnsweredAssumed Answered

Get Volume VBA

Question asked by Juan David Rico Molano on Aug 2, 2017
Latest reply on Aug 2, 2017 by Juan David Rico Molano

Hello everyone.

I've had some problems trying to get the volume from the model to a variable into vba. I've found a way and it is like this:

 

Sub main()

 

Set swApp = Application.SldWorks

Dim instance As IMassProperty

Dim value As System.Double

 

 

value = instance.density

 

End Sub

 

When I run the macro, Dim value As System.Double is highlighted and this error appears:

 

Compile error:

User-defined type not defined

 

I think I need to activate some references but I don't know exactly which one.

 

Thank you

Outcomes