vba, Set value of Custom Propertie in Piping

Hello All,

We are using SolidWorks for drawing "custom pipes and bends".
We want to extract some additional data that the user can add by selecting certain items. F.i. the user can select if the selected pipe(s) should be created in the workshop or not. In the attached example the value of the a Custom Property [UseThisPart] of the selected items (the blue items) should be set to "Yes" (the other items should stay "No").

I have tried to use Custom Properties. But in case I change a value of a Custom Property of a single pipe, the value for all the other pipes (with the same configuration) will change.

Is there a way to change/set the value of a single item (pipe/bend) without changing the value of all the other items?

I have used the following code to read/get/change the custom properties:

  Dim oCustPropMgr As CustomPropertyManager
  Dim strValOutName As String
  Dim strResolvedValOut As String
  Dim strValOutPartNr As String
  Dim strSizeResolvedValOut As String
  Dim strValOutUseThisPart As String
  Dim strResolvedUseThisPart As String
  ''
  Dim oSldWorksModelDoc As SldWorks.ModelDoc2
  Dim strPartInfo As String
  ''
  Dim vNameArr As Variant
  Dim vName As Variant
  Dim blnRet As Boolean
 
  ''' On error goto the error handler defined in the lower part of this function.
  On Error GoTo ErrHandler
 
  Set oSldWorksModelDoc = oSldWorksComponent.GetModelDoc2

  Set oCustPropMgr = oSldWorksModelDoc.Extension.CustomPropertyManager(oSldWorksComponent.ReferencedConfiguration)
  Call oCustPropMgr.Get4("Name", False, strValOutName, strResolvedValOut)
  Call oCustPropMgr.Get4("PartNo", False, strValOutPartNr, strSizeResolvedValOut)
 
  '' Set value
  Dim lRetVal As Long
  lRetVal = oCustPropMgr.Set2("UseThisPart", "YES") ' "NO"
  Call oCustPropMgr.Get4("UseThisPart", False, strValOutUseThisPart, strResolvedUseThisPart)    
 
  '' Get all names
  vNameArr = oCustPropMgr.GetNames
  If IsEmpty(vNameArr) Then Exit Sub
  strPartInfo = oSldWorksComponent.ReferencedConfiguration & ", Name: " & strValOutName & ", PartNo: " & strValOutPartNr & ", UseThisPart: " & strValOutUseThisPart

  Debug.Print "***Part Info: "
  Debug.Print strPartInfo
 
  ''' Exit the Sub
  Exit Sub
 
''' Define the subfunction for errorhandling.
ErrHandler:
 '''Error.
  Call MsgBox("ExportRouting, function : mTestCustomProps", _
              "Get props single element", _
               Err.Number, _
               Err.Description)

Thanks in advance!

SolidworksApi/macros