Shape.ConnectionSiteCount property (Publisher)
Returns a Long indicating the count of connection sites on the current Shape object. Read-only.
Syntax
expression.ConnectionSiteCount
expression A variable that represents a Shape object.
Remarks
The number of connection sites varies depending on the shape geometry. Rectangular objects including tables and web controls will most likely have four connection sites, one centered on each edge of the shape.
Example
This example adds two rectangles to the active publication and joins them with two connectors. The beginnings of both connectors attach to connection site one on the first rectangle; the ends of the connectors attach to the first and last connection sites of the second rectangle. It then counts the number of connections on the first rectangle.
Sub Connections()
Dim shpNew As Shapes
Dim shpFirstRect As Shape
Dim shpSecondRect As Shape
Dim intLastSite As Integer
Dim intCount As Integer
Set shpNew = Application.ActiveDocument _
.MasterPages(Item:=1).Shapes
Set shpFirstRect = shpNew.AddShape(Type:=msoShapeRectangle, _
Left:=100, Top:=50, Width:=200, Height:=100)
Set shpSecondRect = shpNew.AddShape(msoShapeRectangle, _
Left:=300, Top:=300, Width:=200, Height:=100)
varLastSite = shpSecondRect.ConnectionSiteCount
' Add the first connector from rectangle 1,
' site 1 to rectangle 2, site 1.
With shpNew.AddConnector(Type:=msoConnectorCurve, _
BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _
.ConnectorFormat
.BeginConnect ConnectedShape:=shpFirstRect, ConnectionSite:=1
.EndConnect ConnectedShape:=shpSecondRect, ConnectionSite:=1
End With
' Add the second connector from rectangle 1,
' site 1 to rectangle 2, site 2.
With shpNew.AddConnector(Type:=msoConnectorCurve, _
BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _
.ConnectorFormat
.BeginConnect ConnectedShape:=shpFirstRect, ConnectionSite:=1
.EndConnect ConnectedShape:=shpSecondRect, _
ConnectionSite:=intLastSite
End With
intCount = shpFirstRect.ConnectionSiteCount
End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for