Table of contents
TOC
Collapse the table of content
Expand the table of content

Shapes.AddConnector Method (Project)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

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

NameRequired/OptionalData TypeDescription
TypeRequiredMsoConnectorTypeThe type of connector. Can be one of the following constants: msoConnectorElbow, msoConnectorTypeMixed, msoConnectorCurve, or msoConnectorStraight.
BeginXRequiredSingleThe horizontal position (in points) of the connector's starting point, relative to the upper-left corner of the document.
BeginYRequiredSingleThe vertical position (in points) of the connector's starting point.
EndXRequiredSingleThe horizontal position (in points) of the connector's end point.
EndYRequiredSingleThe vertical position (in points) of the connector's end point.
TypeRequiredMSOCONNECTORTYPE
BeginXRequiredFLOAT
BeginYRequiredFLOAT
EndXRequiredFLOAT
EndYRequiredFLOAT
NameRequired/OptionalData typeDescription

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) do not work. You can use only the AddConnector parameters to position the connector. For more information, see theConnectorFormat 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

Other resources

Shapes ObjectShape ObjectConnectorFormat PropertyAutoShapeType PropertyMsoConnectorType

© 2018 Microsoft