I wanted to remove the broken publications which are having No Element Status only highlighted in yellow as shown below.
Below is my code its not giving full result. please help me to resolve this.
Sub CATMain()
Set CATIA = GetObject(, "CATIA.APPLICATION")
Set oSelection = CATIA.ActiveDocument.Selection
oSelection.Search "CATAsmSearch.Part,all"
For i = 1 To oSelection.Count
Dim num_of_publ_existing As Integer
num_of_publ_existing = oSelection.Item(i).Value.Publications.Count
ReDim aa(num_of_publ_existing)
For k = 1 To num_of_publ_existing
PubName = oSelection.Item(i).Value.Publications.Item(k).Name
Set pubRef = oSelection.Item(i).Value.Publications.Item(PubName).Valuation
If pubRef.DisplayName <> "" Then
aa(k - 1) = PubName
Debug.Print PubName
Debug.Print pubRef.DisplayName
End If
Next
For j = 0 To num_of_publ_existing
oSelection.Item(i).Value.Publications.Remove (aa(j))
Next
Next
oSelection.Clear
End Sub