Share via


ConnectorFormat.BeginConnect Method

Attaches the beginning of the specified connector to a specified shape.

Namespace:  Microsoft.Office.Interop.PowerPoint
Assembly:  Microsoft.Office.Interop.PowerPoint (in Microsoft.Office.Interop.PowerPoint.dll)

Syntax

'Declaration
Sub BeginConnect ( _
    ConnectedShape As Shape, _
    ConnectionSite As Integer _
)
'Usage
Dim instance As ConnectorFormat
Dim ConnectedShape As Shape
Dim ConnectionSite As Integer

instance.BeginConnect(ConnectedShape, _
    ConnectionSite)
void BeginConnect(
    Shape ConnectedShape,
    int ConnectionSite
)

Parameters

  • ConnectionSite
    Type: System.Int32
    A connection site on the shape specified by ConnectedShape. Must be an integer between 1 and the integer returned by the ConnectionSiteCount property of the specified shape. If you want the connector to automatically find the shortest path between the two shapes it connects, specify any valid integer for this argument and then use the RerouteConnections method after the connector is attached to shapes at both ends.

Remarks

If there's already a connection between the beginning of the connector and another shape, that connection is broken. If the beginning of the connector isn't already positioned at the specified connecting site, this method moves the beginning of the connector to the connecting site and adjusts the size and position of the connector. Use the EndConnect(Shape, Int32) method to attach the end of the connector to a shape.

When you attach a connector to an object, the size and position of the connector are automatically adjusted, if necessary.

Examples

This example adds two rectangles to the first slide in the active presentation and connects them with a curved connector. Notice that the RerouteConnections method makes it irrelevant what values you supply for the ConnectionSite arguments used with the BeginConnect and EndConnect methods.

Set myDocument = ActivePresentation.Slides(1)

Set s = myDocument.Shapes

Set firstRect = s.AddShape(msoShapeRectangle, 100, 50, 200, 100)

Set secondRect = s.AddShape(msoShapeRectangle, 300, 300, 200, 100)

With s.AddConnector(msoConnectorCurve, 0, 0, 100, 100) _

        .ConnectorFormat

    .BeginConnectConnectedShape:=firstRect, ConnectionSite:=1

    .EndConnect ConnectedShape:=secondRect, ConnectionSite:=1

    .Parent.RerouteConnections

End With

See Also

Reference

ConnectorFormat Interface

ConnectorFormat Members

Microsoft.Office.Interop.PowerPoint Namespace