Share via


EndDisconnect Method [Publisher 2003 VBA Language Reference]

Detaches the end of the specified connector from the shape to which it's attached.

expression.EndDisconnect

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

This method doesn't alter the size or position of the connector; the end of the connector remains positioned at a connection site but is no longer connected.

Use the BeginDisconnect method to detach the beginning of the connector from a shape.

Example

This example adds two rectangles to the first page in the active publication, attaches them with a connector, automatically reroutes the connector along the shortest path, and then detaches the connector from the rectangles.

Dim shpRect1 As Shape
Dim shpRect2 As Shape

With ActiveDocument.Pages(1).Shapes

    ' Add two new rectangles.
    Set shpRect1 = .AddShape(Type:=msoShapeRectangle, _
        Left:=100, Top:=50, Width:=200, Height:=100)
    Set shpRect2 = .AddShape(Type:=msoShapeRectangle, _
        Left:=300, Top:=300, Width:=200, Height:=100)

    ' Add a new connector.
    With .AddConnector(Type:=msoConnectorCurve, _
            BeginX:=0, BeginY:=0, EndX:=0, EndY:=0) _
            .ConnectorFormat

        ' Connect the new connector to the two rectangles.
        .BeginConnect ConnectedShape:=shpRect1, ConnectionSite:=1
        .EndConnect ConnectedShape:=shpRect2, ConnectionSite:=1

        ' Reroute the connector to create the shortest path.
        .Parent.RerouteConnections

        ' Disconnect the new connector from the rectangles but
        ' leave in place.
        .BeginDisconnect
        .EndDisconnect
    End With

End With

Applies to | ConnectorFormat Object