2 Replies Latest reply on Mar 31, 2017 5:16 PM by Raghvendra Bhargava

    Is it possible to set the configuration when adding a part to an assembly using a VBA macro?

    Peter McCourt

      I am trying to add multiple configurations of the same part to an assembly using a macro. Is this possible? The following will insert the part but only in the last saved configuration:


      Set SwApp = Application.SldWorks

      Set Exl = Excel.Application


      SwApp.DocumentVisible False, swDocumentTypes_e.swDocPART


      Set Part = SwApp.OpenDoc6(SLD_Path, 1, 0, "A", Longstatus, Longwarnings)


      Set Part = SwApp.ActiveDoc

      boolstatus = Part.AddComponent(SLD_Path, 0, 0, 0)


      SwApp.DocumentVisible True, swDocumentTypes_e.swDocPART


      End Sub