Can anyone help? I'm trying to set the density of a model by entering the mass (in kg) using VB6, so that I can record mass of bought out items eg motors etc. I was able to do it before using the following code but it doesn't work anymore. The API help file doesn't help, I've tried all methods but keep getting errors. The idea is to enter the mass in a text box and click abutton to set the density. Code: Private Sub cmdCalc_Click() Dim massProps As Variant Dim Den, Mass As Variant Dim Vol As Variant Set swApp = CreateObject("SldWorks.Application") Set Part = swApp.ActiveDoc Const swMaterialPropertyDensity = 7 massProps = Part.GetMassProperties ' Get the mass properties Vol = massProps(3) Mass = txtMass.Text Den = Mass / massProps(3) txtDensity.Text = Den Retval = Part.SetUserPreferenceDoubleValue(swMaterialPropertyDensity, txtDensity.Text) 'sets density for model End Sub Thanks in advance