Partager via


Propriété Connect.ToPart (Visio)

Renvoie la partie de la forme avec laquelle une connexion est établie. En lecture seule.

Syntaxe

expression. ToPart

expression Variable qui représente un objet Connect .

Valeur renvoyée

Entier

Remarques

La propriété ToPart identifie la partie d'une forme à laquelle une autre forme est collée, comme son point de début ou son point de fin, l'un de ses côtés ou un point de connexion. Les constantes suivantes, déclarées par la bibliothèque de types de Visio dans le membre VisToParts, indiquent les valeurs de renvoi possibles pour la propriété ToPart.

Constante Valeur
visConnectToError -1
visToNone 0
visGuideX 1
visGuideY 2
visWholeShape 3
visGuideIntersect 4
visToAngle 7
visConnectionPoint 100 + index de ligne de point de connexion

Exemple

Cette macro Microsoft Visual Basic pour Applications (VBA) indique comment extraire des informations de connexion à partir d’un dessin Microsoft Visio. L’exemple affiche les informations de connexion dans la fenêtre Exécution.

L'exemple implique qu'il y ait un document actif contenant au moins deux formes connectées.

 
Public Sub ToPart_Example() 
 
 Dim vsoShapes As Visio.Shapes 
 Dim vsoShape As Visio.Shape 
 Dim vsoConnectTo As Visio.Shape 
 Dim intToData As Integer 
 Dim strTo As String 
 Dim vsoConnects As Visio.Connects 
 Dim vsoConnect As Visio.Connect 
 Dim intCurrentShapeID As Integer 
 Dim intCounter As Integer 
 
 Set vsoShapes = ActivePage.Shapes 
 
 'For each shape on the page, get its connections. 
 For intCurrentShapeID = 1 To vsoShapes.Count 
 
 Set vsoShape = vsoShapes(intCurrentShapeID) 
 Set vsoConnects = vsoShape.Connects 
 
 'For each connection, get the shape it connects to 
 'and the part of the shape it connects to, 
 'and print that information in the Immediate window. 
 For intCounter = 1 To vsoConnects.Count 
 
 Set vsoConnect = vsoConnects(intCounter) 
 Set vsoConnectTo = vsoConnect.ToSheet 
 intToData = vsoConnect.ToPart 
 
 If intToData = visConnectError Then 
 strTo = "error" 
 ElseIf intToData = visNone Then 
 strTo = "none" 
 ElseIf intToData = visGuideX Then 
 strTo = "guideX" 
 ElseIf intToData = visGuideY Then 
 strTo = "guideY" 
 ElseIf intToData = visWholeShape Then 
 strTo = "dynamic glue" 
 ElseIf intToData >= visConnectionPoint Then 
 strTo = "connection point " & _ 
 CStr(intToData - visConnectionPoint + 1) 
 Else 
 strTo = "???" 
 End If 
 
 'Print the name and part of the shape the 
 'Connect object connects to. 
 Debug.Print "To "; vsoConnectTo.Name & " " & strTo & "." 
 
 Next intCounter 
 
 Next intCurrentShapeID 
 
End Sub

Assistance et commentaires

Avez-vous des questions ou des commentaires sur Office VBA ou sur cette documentation ? Consultez la rubrique concernant l’assistance pour Office VBA et l’envoi de commentaires afin d’obtenir des instructions pour recevoir une assistance et envoyer vos commentaires.