Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Per company standards I need 2 parts lists. The lists are fairly large. I need to display ONLY the balloons that are called out in the parts list. The link below is from an older thread. The code supplied works but only for a sheet with 1 Parts List.
Is there a way to modify this so you can select the list that you want to run the code on?
The way I have my 2 lists separated are by "NORMAL" which are my components and "PURCHASED" which is my 2nd list of hardware.
The code that I am using that works on one list only is this:
Sub Main() Dim oDoc As Document = ThisDoc.Document If oDoc.DocumentType <> kDrawingDocumentObject Then: MsgBox("Run in drawings only!"): Exit Sub: End If Dim oSheet As Sheet = oDoc.ActiveSheet If oSheet Is Nothing Then: MsgBox("Only valid for dwg files with sheets!"): Exit Sub: End If If oSheet.PartsLists.Count <> 1 Then: MsgBox("Only valid for sheets with 1 PartsList"):Exit Sub: End If Dim oPL As PartsList = oSheet.PartsLists(1) If oPL.PartsListRows.Count < 1 Then: MsgBox("Only valid for partslists with actual rows"): Exit Sub: End If If oSheet.Balloons.Count < 1 Then: MsgBox("Rule only valid for sheets with balloons!"): Exit Sub: End If On Error Resume Next For Each oRow In oPL.PartsListRows oRow.Visible = False Next If Err.Number <> 0 Then: MsgBox("Issue setting row visibility or accessing rows..."): End If Err.Clear On Error Resume Next Dim oIN As String For Each oBalloon In oSheet.Balloons oIN = oBalloon.BalloonValueSets(1).ItemNumber If Err.Number <> 0 Then: MsgBox("Issue grabbing balloon item number.."): End If Err.Clear For Each oRow In oPL.PartsListRows If oRow.Item(1).Value = oIN oRow.Visible = True End If Next If Err.Number <> 0 Then: MsgBox("Issue iterating PL/setting visibility back on"): End If Err.Clear Next On Error GoTo 0 End Sub
Solved! Go to Solution.