HI,
I would like de write a macro, for catdrawings, to check to wicht Parts the balloons are linked.
I saw the post Link and try the metode "HeadTaget"
Ther my code:
But it don't works : i allways have the message : "methode HeadTarget failed"
Regards
Marc.
Regards
Marc
I would like de write a macro, for catdrawings, to check to wicht Parts the balloons are linked.
I saw the post Link and try the metode "HeadTaget"
Ther my code:
Code:
'**************************************************************
'*** Macro To check witch Part the balloon is pointed ***
'*** ***
'*** VBA ***
'*** ***
'**************************************************************
Sub CATMain()
On Error Resume Next
Set MonDessin = CATIA.ActiveDocument
If (Err.Number <> 0) Then
MsgBox ("Un CATDrawing doit être actif")
Exit Sub
End If
If (InStr(MonDessin.Name, ".CATDrawing")) = 0 Then
MsgBox ("La fenêtre active doit être un CATDrawing")
Exit Sub
End If
Err.Clear
On Error GoTo 0
Dim ElemDispatch As CATBaseDispatch
Dim myBalloon As DrawingText
Dim myleaders As DrawingLeaders
Dim myleader As DrawingLeader
Set selection1 = MonDessin.Selection
'selection1.Search "Name=Numéro de pièce*,all" ' CATIA IN FRENCH
selection1.Search "Name=Balloon*,all" ' CATIA IN ENGLICH
For i = 1 To selection1.Count
Set myBalloon = selection1.Item(i).Value
Set myleaders = myBalloon.Leaders
Set myleader = myleaders.Item(1)
Set ElemDispatch = Nothing
Set ElemDispatch = myleader.HeadTarget
MsgBox myBalloon.Text & "-" & myleader.Name & "-" & ElemDispatch.Name
Next
End Sub
But it don't works : i allways have the message : "methode HeadTarget failed"
Regards
Marc.
Regards
Marc