向报表添加一条线,并返回一个代表该线条的 Shape 对象。
语法
expression。
AddLine
( BeginX,BeginY,EndX,EndY )
expression:一个表示 Shapes 对象的变量。
参数
名称 | 必需/可选 | 数据类型 | 说明 |
---|---|---|---|
BeginX | 必需 | Single | 相对于报表的左边缘,起点) 的水平位置 (磅。 |
BeginY | 必需 | Single | 相对于报表上边缘,起点) 垂直位置 (磅。 |
EndX | 必需 | Single | 相对于报表的左边缘,终点) 的水平位置 (磅。 |
EndY | 必需 | Single | 相对于报表上边缘,垂直位置 (终结点) 磅。 |
BeginX | 必需 | FLOAT | |
BeginY | 必需 | FLOAT | |
EndX | 必需 | FLOAT | |
EndY | 必需 | FLOAT | |
名称 | 必需/可选 | 数据类型 | 说明 |
返回值
Shape
备注
若要设置线条的格式,请使用 Shape.Line 属性。
示例
以下示例创建一条紫色虚线,末尾有一个箭头。
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
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。