Community
I have a checking rule where a part of it iterates through a parts list. However, when there's no parts list it errors.
The reason is the initial call....
Dim oPartList As PartsList
oPartList = oDoc.ActiveSheet.PartsLists.Item(1)
So if a drawing has no parts list, how can I make it jump over this.
You may check PartsLists.Count property value. If it is equal to 0, then partslists collection is empty.
Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet Set oSheet = oDrawDoc.ActiveSheet If oSheet.PartsLists.Count > 0 Then Dim oPartList As PartsList Set oPartList = oSheet.PartsLists.Item(1) Else 'oSheet does not contain any PartsList End If
cheers,