Shapes.AddLine method (Project)
Adds a line to a report, and returns a Shape object that represents the line.
Syntax
expression. AddLine
(BeginX, BeginY, EndX, EndY)
expression A variable that represents a Shapes object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
BeginX | Required | Single | The horizontal position (in points) of the starting point, relative to the left edge of the report. |
BeginY | Required | Single | The vertical position (in points) of the starting point, relative to the top edge of the report. |
EndX | Required | Single | The horizontal position (in points) of the end point, relative to the left edge of the report. |
EndY | Required | Single | The vertical position (in points) of the end point, relative to the top edge of the report. |
BeginX | Required | FLOAT | |
BeginY | Required | FLOAT | |
EndX | Required | FLOAT | |
EndY | Required | FLOAT | |
Name | Required/Optional | Data type | Description |
Return value
Shape
Remarks
To format the line, use the Shape.Line property.
Example
The following example creates a violet dashed line with an arrow at the end.
Sub AddBigArrow()
Dim shapeReport As Report
Dim reportName As String
Dim lineShape As shape
' Add a report.
reportName = "Line report"
Set shapeReport = ActiveProject.Reports.Add(reportName)
Set lineShape = shapeReport.Shapes.AddLine(20, 50, 320, 100)
With lineShape.Line
.DashStyle = msoLineDashDot
.Weight = 3
.EndArrowheadStyle = msoArrowheadTriangle
.EndArrowheadWidth = msoArrowheadWidthMedium
.ForeColor.RGB = &HFF0090
End With
End Sub
See also
Shapes Object Shape Object Line Property
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.