ChTitle Object

Microsoft Office Web Components Visual Basic

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