AddConnector Method

Microsoft Word Visual Basic

object that represents a connecting line between two shapes in a drawing canvas.

expression.AddConnector(Type, BeginX, BeginY, EndX, EndY)

expression    Required. An expression that returns a CanvasShapes object.

Type   Required MsoConnectorType. The type of connector.

MsoConnectorType can be one of these MsoConnectorType constants.
msoConnectorCurve
msoConnectorElbow
msoConnectorStraight
msoConnectorTypeMixed Not used with this method.

BeginX   Required Single. The horizontal position that marks the beginning of the connector.

BeginY   Required Single. The vertical position that marks the beginning of the connector.

EndX   Required Single. The horizontal position that marks the end of the connector.

EndY   Required Single. The vertical position that marks the end of the connector.

Example

The following example adds a straight connector to a new canvas in a new document.

Sub AddCanvasConnector()

    Dim docNew As Document
    Dim shpCanvas As Shape

    Set docNew = Documents.Add

    'Add drawing canvas to new document
    Set shpCanvas = docNew.Shapes.AddCanvas( _
        Left:=150, Top:=150, Width:=200, Height:=300)

    'Add connector to the drawing canvas
    shpCanvas.CanvasItems.AddConnector _
        Type:=msoConnectorStraight, BeginX:=150, _
        BeginY:=150, EndX:=200, EndY:=200

End Sub