在报表中创建无边框线条标注。 返回表示新标注的 Shape 对象。
语法
expression。
AddCallout
( Type,Left,Top,Width,Height )
expression:一个表示 Shapes 对象的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 说明 |
|---|---|---|---|
| Type | 必需 | MsoCalloutType | 标注的类型。 |
| Left | 必需 | Single | 标注的边界框左边缘的位置( 以磅为单位)。 |
| Top | 必需 | Single | 标注的边界框顶部边缘的位置( 以点为单位)。 |
| Width | 必需 | Single | 标注的边界框的宽度( 以磅为单位)。 |
| Height | 必需 | Single | 标注的边界框的高度( 以磅为单位)。 |
| Type | 必需 | MSOCALLOUTTYPE | |
| Left | 必需 | FLOAT | |
| Top | 必需 | FLOAT | |
| Width | 必需 | FLOAT | |
| Height | 必需 | FLOAT |
返回值
Shape
备注
Type 参数可以是以下 MsoCalloutType 常量之一:
| msoCalloutOne:可以是水平或垂直的单段标注线。 |
| msoCalloutTwo:自由旋转的单段标注线。 |
| msoCalloutMixed:指示其他状态组合的返回值。 |
| msoCalloutThree:两段线,其中线段的端点可以拖动到不同的位置。 |
| msoCalloutFour:三段线。 |
可以使用 AddShape 方法插入种类更多的标注,例如气球和云。
示例
下面的示例添加带有两段标注线的标注,将结束段的角度设置为与垂直方向成 60 度,并将文本添加到标注中。
Sub AddCallout()
Dim oReports As Reports
Dim oReport As Report
Dim calloutShape As shape
Dim reportName As String
reportName = "Report 1"
Set oReports = ActiveProject.Reports
If oReports.IsPresent(reportName) Then
' Make the report the active view.
oReports(reportName).Apply
Set oReport = oReports(reportName)
Set calloutShape = oReport.Shapes.AddCallout(Type:=msoCalloutTwo, _
left:=200, top:=5, width:=100, height:=50)
With calloutShape
.Callout.Type = msoCalloutThree
.Callout.Angle = msoCalloutAngle60
.BackgroundStyle = msoBackgroundStylePreset10
.TextFrame2.TextRange.Text = "This is a test"
End With
Else
MsgBox Prompt:="The requested report, '" & reportName _
& "', does not exist.", Title:="Report error"
End If
End Sub
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。