Shapes.AddCallout method (Project)

Creates a borderless line callout in a report. Returns a Shape object that represents the new callout.

Syntax

expression. AddCallout (Type, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name Required/Optional Data type Description
Type Required MsoCalloutType The type of callout.
Left Required Single The position, in points, of the left edge of the bounding box for the callout.
Top Required Single The position, in points, of the top edge of the bounding box for the callout.
Width Required Single The width, in points, of the bounding box for the callout.
Height Required Single The height, in points, of the bounding box for the callout.
Type Required MSOCALLOUTTYPE
Left Required FLOAT
Top Required FLOAT
Width Required FLOAT
Height Required FLOAT

Return value

Shape

Remarks

The Type parameter can be one of the following MsoCalloutType constants:

msoCalloutOne: A single-segment callout line that can be horizontal or vertical.
msoCalloutTwo: A single-segment callout line that rotates freely.
msoCalloutMixed: A return value that indicates a combination of the other states.
msoCalloutThree: A two-segment line, where the segment ends can be dragged to different positions.
msoCalloutFour: A three-segment line.

You can insert a greater variety of callouts, such as balloons and clouds, by using the AddShape method.

Example

The following example adds a callout with a two-segment callout line, sets the angle of the end segment to 60 degrees from the vertical, and adds text to the callout.

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

See also

Shapes Object Shape Object AddShape Method

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.