Shapes.AddConnector method (Project)
Creates a connector and returns a Shape object the represents the new connector.
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 type of connector. Can be one of the following constants: msoConnectorElbow, msoConnectorTypeMixed, msoConnectorCurve, or msoConnectorStraight. |
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. |
EndX | Required | Single | The horizontal position (in points) of the connector's end point. |
EndY | Required | Single | The vertical position (in points) of the connector's end point. |
Type | Required | MSOCONNECTORTYPE | |
BeginX | Required | FLOAT | |
BeginY | Required | FLOAT | |
EndX | Required | FLOAT | |
EndY | Required | FLOAT | |
Name | Required/Optional | Data type | Description |
Return value
Shape
Remarks
Note
In Project, the methods to attach the beginning and end of a connector to other shapes in the report (ConnectorFormat.BeginConnect and ConnectorFormat.EndConnect) don't work. Use only the AddConnector parameters to position the connector. For more information, see the ConnectorFormat property.
Example
The following example creates a report that contains two cloud shapes, and then adds a blue-green curved connector line that is two points wide.
Sub ConnectClouds()
Dim shapeReport As Report
Dim reportName As String
Dim connectorShape As shape
' Add a report.
reportName = "Cloud report"
Set shapeReport = ActiveProject.Reports.Add(reportName)
' Add two clouds.
Dim cloudShape1 As shape
Dim cloudShape2 As shape
Set cloudShape1 = shapeReport.Shapes.AddShape(msoShapeCloud, 20, 20, 100, 60)
Set cloudShape2 = shapeReport.Shapes.AddShape(msoShapeCloud, 100, 200, 60, 100)
Set connectorShape = shapeReport.Shapes.AddConnector(msoConnectorCurve, 80, 80, 130, 200)
With connectorShape
.Line.Weight = 2
.Line.ForeColor.RGB = &HAAFF00
End With
End Sub
See also
Shapes Object Shape Object ConnectorFormat Property AutoShapeType Property MsoConnectorType
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.