Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
GeorgK
635 Views, 7 Replies

sorting bom problem

Hello together,

 

I have a problem to sort my drawing bom. The first step is to sort the "part number" ascending, which is working.

 

Public Sub PartListEdit()
    ' Set a reference to the drawing document.
    ' This assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
    Set oDrawDoc = ThisApplication.ActiveDocument
    
    ' Set a reference to the first parts list on the active sheet.
    ' This assumes that a parts list is on the active sheet.
    Dim oPartList As PartsList
    Set oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(1)
    
    ' Iterate through the contents of the parts list.
    Dim i As Long
    For i = 1 To oPartList.PartsListRows.Count
        ' Get the current row.
        Dim oRow As PartsListRow
        Set oRow = oPartList.PartsListRows.Item(i)
        
        ' Iterate through each column in the row.
        Dim j As Long
        For j = 1 To oPartList.PartsListColumns.Count
            ' Get the current cell.
            Dim oCell As PartsListCell
            Set oCell = oRow.Item(j)
            
            
            If oPartList.PartsListColumns.Item(j).Title  "Part number" Then
                'Do some work
            End If
        Next
    Next
    
   
End Sub

In the next step I would like to sort the parts with the name from 1 to x

  1. S000AxxxxxxxxxP001
  2. S000AxxxxxxxxxP002
  3. S000AxxxxxxxxxP003

 

xxxxxxxxx could be numbers or text.

 

The remaining parts should get a number from 100 to xx
How could I do this?

 

Thank you

Georg