Table of contents
TOC
Collapse the table of content
Expand the table of content

Shapes.AddCallout Method (Project)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

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

NameRequired/OptionalData typeDescription
TypeRequiredMsoCalloutTypeThe type of callout.
LeftRequiredSingleThe position, in points, of the left edge of the bounding box for the callout.
TopRequiredSingleThe position, in points, of the top edge of the bounding box for the callout.
WidthRequiredSingleThe width, in points, of the bounding box for the callout.
HeightRequiredSingleThe height, in points, of the bounding box for the callout.
TypeRequiredMSOCALLOUTTYPE
LeftRequiredFLOAT
TopRequiredFLOAT
WidthRequiredFLOAT
HeightRequiredFLOAT

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

Other resources

Shapes ObjectShape ObjectAddShape Method

© 2018 Microsoft