Expand structured parts list based on cell value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I'm currently working on vba macro that would expand parts list based on cell value. So if any subassembly contains parts or subassemblies with cell value anything else than "No" it would then expand parts list.
This is my code currently:
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
Dim oPartlist As PartsList
Set oPartlist = oSheet.PartsLists.Item(1)
Dim i As Long
Dim FirstRowCount As Integer
Dim LastRowCount As Integer
Do Until FirstRowCount = LastRowCount
FirstRowCount = oPartlist.PartsListRows.Count
For i = 1 To oPartlist.PartsListRows.Count
Dim oCell As PartsListCell
Set oCell = oPartlist.PartsListRows.Item(i).Item("Part Type")
If oCell.Value = "Spare part" Or oCell.Value = "Wear part" Then
oPartlist.PartsListRows.Item(i).Expanded = True
End If
Next
LastRowCount = oPartlist.PartsListRows.Count
Loop
But it doesn't do anything. So any heads up where the problem might be?
Link copied