10-10-2023
01:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-10-2023
01:26 PM
How can I get the Part Number of each document (line) existing on a parts list?
I'm traversing each line in the parts list but don't know how to access part numbers of those referenced documents.
Thank you!
Solved! Go to Solution.
10-10-2023
01:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-10-2023
01:42 PM
Oh, I found it in the end...
If Not ThisApplication.ActiveDocument.DocumentType = kDrawingDocumentObject Then MessageBox.Show("Hey this rule only runs in Drawing Documents!") Exit Sub End If Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet Dim oPartsList As PartsList Dim oPartsListRow As PartsListRow 'Define Sheet counter Dim iSheetCount As Integer = 0 'iterate through all sheets For Each oSheet In oDrawDoc.Sheets iSheetCount = iSheetCount + 1 'Define Parts List counter Dim iPartsListCount As Integer = 0 'iterate through all Parts List, if there are more than 1 For Each oPartsList In oSheet.PartsLists Dim oPartsListName As String oPartsListName = oPartsList.Title iPartsListCount = iPartsListCount + 1 'Define row counter Dim iRowCount As Integer = 0 For i = 1 To oPartsList.PartsListRows.Count 'skip invisible lines If oPartsList.PartsListRows(i).Visible = "True" Then iRowCount = iRowCount + 1 'Get Column "Part Number" oCell = oPartsList.PartsListRows.Item(i).Item("PART NUMBER") Dim oPartNum As String = oCell.Value MessageBox.Show("Sheet " & "(" & iSheetCount & ")" & _ vbLf & "Parts List " & "(" & iPartsListCount & ")" & " Named: " & oPartsListName & _ vbLf & vbLf & "Line " & "(" & iRowCount & ")" & " PART NUMBER: " & oPartNum) Else 'Skip invisible lines End If Next Next Next