9 Replies Latest reply on Aug 4, 2014 10:00 AM by Deepak Gupta

    Macro writing into configuration specific properties

    Petr Skotnica

      This macro writes a part of filename into custom properties. I need to write the same into configuration specific properties.

      Could anyone help?


      Option Explicit

      Dim swApp           As SldWorks.SldWorks

      Dim swModel         As SldWorks.ModelDoc2

      Dim swCustPropMgr   As SldWorks.CustomPropertyManager

      Dim FILENAME        As String

      Dim PartNo          As String

      Dim Description     As String

      Dim PartTitle       As String

      Sub main()


      Set swApp = Application.SldWorks

      Set swModel = swApp.ActiveDoc

      Set swCustPropMgr = swModel.Extension.CustomPropertyManager("")


      FILENAME = swModel.GetTitle

      PartNo = Left(FILENAME, 13)

      Description = Mid(FILENAME, 15)

      Dim a As String


      FILENAME = Replace(Replace(FILENAME, ".sldprt", "", , , vbTextCompare), ".sldasm", "", , , vbTextCompare)

      swCustPropMgr.Add2 "PartNo", swCustomInfoText, " "

      swCustPropMgr.Set "PartNo", PartNo



      swCustPropMgr.Add2 "Description", swCustomInfoText, " "

      swCustPropMgr.Set "Description", Description



      End Sub