共用方式為


Shapes.AddCallout 方法 (專案)

在報告中建立無邊界的線條呼叫。 回傳一個代表新調閱的 Shape 物件。

語法

expressionAddCallout (類型、左邊、上方、寬度、高度)

expression 代表 Shapes 物件的變數。

參數

名稱 必要/選用 資料類型 描述
Type 必要 MsoCalloutType 圖說文字類型。
Left 必要 Single 數計算,指邊界框左邊的位置。
Top 必要 Single 數計算,指邊界框上緣的位置。
Width 必要 Single 以點數計算的邊界框寬度。
Height 必要 Single 數計算的邊界框高度。
Type 必要 MSOCALLOUTTYPE
Left 必要
Top 必要
Width 必要
Height 必要

傳回值

圖形

註解

型別參數可以是以下 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

另請參閱

形狀 物件形狀物件物件 AddShape 方法

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應