Partager via


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 collection.

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

Concepts

CanvasShapes Collection

CanvasShapes Object Members