Share via


ChTitle Object

Multiple objects
ChTitle
Multiple objects

Represents the title of a chart workspace, axis, or chart.

Using the ChTitle object

Use the HasTitle or HasChartspaceTitle property to enable titles.

The following properties return a ChTitle object:

The ChartSpace object's ChartSpaceTitle property

The ChAxis object's Title property

The ChChart object's Title property

The following example adds a title to the first chart in Chartpsace1 and then formats the newly-created title.

Sub AddChartTitle()

    Dim Chart1Title
    Dim chConstants

    Set chConstants = ChartSpace1.Constants

    ' Enable the title for the first chart in the
    ' chartspace.
    ChartSpace1.Charts(0).HasTitle = True

    ' Set a variable to the chart title.
    Set Chart1Title = ChartSpace1.Charts(0).Title

    ' Set the caoption for the title.
    Chart1Title.Caption = "2000 Sales by Department"

    ' Set the title to display at the bottom of the chart.
    Chart1Title.Position = chConstants.chTitlePositionBottom

    ' Format the font used for the title.
    Chart1Title.Font.Bold = True
    Chart1Title.Font.Name = "Tahoma"
    Chart1Title.Font.Size = 16

End Sub

Properties | Border Property | Bottom Property | Caption Property | Font Property | Interior Property | Left Property | ObjectType Property | Parent Property | Position Property | Right Property | Top Property

Methods | Select Method

Parent Objects | ChartSpace Object | ChAxis Object | ChChart Object | ChChartSpace Object

Child Objects | ChBorder Object | ChFont Object | ChInterior Object