Compartir a través de


Propiedad Connect.ToPart (Visio)

Devuelve la parte de una forma con la que se realiza una conexión. Solo lectura.

Sintaxis

expresión. ToPart

expresión Variable que representa un objeto Connect .

Valor devuelto

Entero

Observaciones

La propiedad ToPart identifica la parte de una forma a la que está pegada otra forma; por ejemplo, su punto inicial o final, uno de sus bordes o un punto de conexión. Las constantes siguientes declaradas por la biblioteca de tipos de Visio en el miembro VisToParts muestran los valores que puede devolver la propiedad ToPart.

Constante Valor
visConnectToError -1
visToNone 0
visGuideX 1
visGuideY 2
visWholeShape 3
visGuideIntersect 4
visToAngle 7
visConnectionPoint 100 + índice de fila del punto de conexión

Ejemplo

Esta macro de Microsoft Visual Basic para Aplicaciones (VBA) muestra cómo extraer información sobre la conexión de un dibujo de Microsoft Visio. El ejemplo muestra la información sobre las conexiones en la ventana Inmediato.

En este ejemplo se da por hecho que existe un documento activo que contiene al menos dos formas conectadas.

 
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

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.