AnsweredAssumed Answered

Delete equation

Question asked by Chris Johnson on Apr 2, 2014
Latest reply on Mar 28, 2018 by David Mandl

Hi All,

Im trying to delete an equation but cant get it working.


does anyonwe see where im going wrong?


Sub main()


    Dim swApp                   As SldWorks.SldWorks

    Dim swModel                As SldWorks.ModelDoc2

    Dim swEqnMgr             As SldWorks.EquationMgr

    Dim i                           As Long



    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Set swEqnMgr = swModel.GetEquationMgr




    For i = i To swEqnMgr.GetCount - 1


     Debug.Print swEqnMgr.Equation(i)

     ' This returns: "D1@Sketch1" = 7


           If swEqnMgr.Equation(i) = """D1@Sketch1""=" & "=" & "7" Then


                swEqnMgr.Suppression(i) = True 'suppress To delete the Equation



            End If

    Next i

End Sub


Thank you!