CanvasShapes.AddConnector method (Word)

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

Syntax

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

expression Required. A variable that represents a CanvasShapes object.

Parameters

Name Required/Optional Data type Description
Type Required MsoConnectorType The type of connector.
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

See also

CanvasShapes Collection

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.