Shapes.AddConnector method (Excel)
Creates a connector. Returns a Shape object that represents the new connector. When a connector is added, it's not connected to anything. Use the BeginConnect and EndConnect methods to attach the beginning and end of a connector to other shapes in the document.
Syntax
expression.AddConnector (Type, BeginX, BeginY, EndX, EndY)
expression A variable that represents a Shapes object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Type | Required | MsoConnectorType | The connector type to add. |
BeginX | Required | Single | The horizontal position (in points) of the connector's starting point relative to the upper-left corner of the document. |
BeginY | Required | Single | The vertical position (in points) of the connector's starting point relative to the upper-left corner of the document. |
EndX | Required | Single | The horizontal position (in points) of the connector's end point relative to the upper-left corner of the document. |
EndY | Required | Single | The vertical position (in points) of the connector's end point relative to the upper-left corner of the document. |
Return value
Shape
Remarks
When you attach a connector to a shape, the size and position of the connector are automatically adjusted, if necessary. Therefore, if you are going to attach a connector to other shapes, the position and dimensions that you specify when adding the connector are irrelevant.
Example
The following example adds a curved connector to a new canvas in a new worksheet.
Sub AddCanvasConnector()
Dim wksNew As Worksheet
Dim shpCanvas As Shape
Set wksNew = Worksheets.Add
'Add drawing canvas to new worksheet
Set shpCanvas = wksNew.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
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.
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin