The Border property and the Border object

This property returns a Border object that represents the border of the object. The Border object can be used to set the color, line style, and weight of the border of an object, such as an axis title.

The Border object has no methods. Its main properties are Color, Colorlndex, LineStyle, and Weight.

The Color property can be set to any RGB value. For instance, the following code sets the major axis color to blue:

ActiveChart.Axes(xlCategory, xlPrimary).

MajorGridlines.Border.Color = RGB(0, 0,_255)

The Colorlndex property can be used to set the color via a color palette. For more information, including the ColorIndex values, see the help documentation.

The LineStyle property can take on any of the following values:

Enum XlLineStyle xlLineStyleNone = -4142 xlDouble = -4119 xlDot = -4118 xlDash = -4115 xlContinuous = 1 xlDashDot = 4 xlDashDotDot = 5 xlSlantDashDot = 13 End Enum

The Weight property can be set to one of the following XLBorderWeight constants:

Enum XlBorderWeight xlMedium = -4138 xlHairline = 1

xlThin = 2 xlThick = 4 End Enum

To further illustrate axis-title formatting, here is the relevant code from the CreateChart procedure:

' Axis formatting With co.Chart.Axes(xlCategory) .HasTitle = True .AxisTitle.Caption = "Types" .AxisTitle.Border.Weight = xlMedium End With

With co.Chart.Axes(xlValue) .HasTitle = True With .AxisTitle

.Caption = "Quantity for 1999" .Font.Size = 6 .Orientation = xlHorizontal .Characters(14, 4).Font.Italic = True .Border.Weight = xlMedium End With End With

0 0

Post a comment