Sidtha
Aerospace
- Nov 25, 2012
- 30
Hello All,
I wanted to remove the broken publication link as shown below.
Written basic to get all publications.
My question is macro listing all publications but it has to list out only broken publication as it was having yellow "!" symbole.
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
'Debug.Print PubRef.DisplayName
'Debug.Print PubRef.Name
If PubRef.DisplayName > 0 Then
aa(k - 1) = PubName
'Debug.Print PubRef.DisplayName
Debug.Print PubName
End If
Next
For j = 0 To num_of_publ_existing
' Debug.Print PubRef.DisplayName
' Debug.Print PubName
' If aa(j) = "" Then
' oSelection.Item(i).Value.Publications.Remove (aa(j))
' End If
Next
Next
oSelection.Clear
End Sub
Please help me to resolve this thank you
I wanted to remove the broken publication link as shown below.
Written basic to get all publications.
My question is macro listing all publications but it has to list out only broken publication as it was having yellow "!" symbole.
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
'Debug.Print PubRef.DisplayName
'Debug.Print PubRef.Name
If PubRef.DisplayName > 0 Then
aa(k - 1) = PubName
'Debug.Print PubRef.DisplayName
Debug.Print PubName
End If
Next
For j = 0 To num_of_publ_existing
' Debug.Print PubRef.DisplayName
' Debug.Print PubName
' If aa(j) = "" Then
' oSelection.Item(i).Value.Publications.Remove (aa(j))
' End If
Next
Next
oSelection.Clear
End Sub
Please help me to resolve this thank you