Microsoft Office Tutorials and References
In Depth Information
Properties and Methods
To add a title to a chart, set the HasTitle property to True. When you do so, the
chart’s title consists of generic text: Chart Title . To actually provide the title text,
you need to access the Text property of the ChartTitle object. The following
procedure demonstrates.
Sub AddTitle()
Charts(“Chart1”).HasTitle = True
Charts(“Chart1”).ChartTitle.Text = “2003 Budget Summary”
End Sub
After executing this routine, the chart on the Chart1 sheet will display 2003
Budget Summary as its title.
The Application object (that is, Excel) has several useful properties:
Application.ActiveWorkbook : Returns the active workbook (a Workbook
object) in Excel.
Application.ActiveSheet : Returns the active sheet (a Sheet object) of
the active workbook.
Application.ActiveChart : Returns the active chart (a Chart object),
if any.
Application.ActiveCell : Returns the active cell (a Range object) object
of the active window.
Application.Selection : Returns the object that is currently selected in
the active window of the Application object. This can be a range, a
chart, a shape, or some other selectable object.
It’s important to understand that properties can return objects. In fact, that’s
exactly what the preceding examples do. The result of Application.ActiveChart ,
for example, is a Chart object. Therefore, you can access properties by using a
statement such as the following:
Application.ActiveChart.HasTitle = True
In this case, Application.ActiveChart is an object, and HasTitle is a
property of the object. Because Application properties are so commonly used, you can
omit the object qualifier ( Application ). For example, to access the HasTitle
property of the active chart, you can use a statement such as the following:
ActiveChart.HasTitle
Search JabSto ::




Custom Search