02-21-2019
04:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-21-2019
04:04 AM
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
- S000AxxxxxxxxxP001
- S000AxxxxxxxxxP002
- 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
Solved! Go to Solution.