Page 377 - Writing Excel Macros with VBA, 2nd Edition
P. 377
21.6 The Axis Object
Table 21-2 shows the properties and methods of the Axis object. As you can see, Axis objects are
fairly involved in their own right. Fortunately, most of the members in Table 21-2 are self-
explanatory, so we consider them only briefly. Note that most of these members correspond to the
myriad check boxes and edit boxes in the five tabs of the Excel Format Axis dialog box.
Table 21-2. Members of the Axis Object
Application HasDisplayUnitLabel<v9> MinorTickMark
AxisBetweenCategories HasMajorGridlines MinorUnit
AxisGroup HasMinorGridlines MinorUnitIsAuto
AxisTitle HasTitle MinorUnitScale
BaseUnit Height Parent
BaseUnitIsAuto Left ReversePlotOrder
Border MajorGridlines ScaleType
CategoryNames MajorTickMark Select
CategoryType MajorUnit TickLabelPosition
Creator MajorUnitIsAuto TickLabels
Crosses MajorUnitScale TickLabelSpacing
CrossesAt MaximumScale TickMarkSpacing
Delete MaximumScaleIsAuto Top
DisplayUnit<v9> MinimumScale Type
DisplayUnitCustom<v9> MinimumScaleIsAuto Width
DisplayUnitLabel<v9> MinorGridlines
21.6.1 AxisGroup Property
This read-only property returns the group for the specified axis. It can be either xlPrimary (=1)
or xlSecondary (=2).
21.6.2 Axis Titles and Their Formatting
The AxisTitle property returns an AxisTitle object that represents the title of the specified axis.
21.6.2.1 HasTitle property (R/W Boolean)
Before we can format an axis title, we must tell Excel that the axis has a title using the HasTitle
property:
AxisObject.HasTitle = True
The AxisTitle object has several properties, the most prominent of which are the following:
AutoScaleFont
Scales the label text font size is automatically when the chart size changes when this
property is True. The default value is True.
363

