Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
emanuel.c
in reply to: emanuel.c

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