Class ChartBorder (Word VBA)

The class ChartBorder represents the border of an object. To use a ChartBorder class variable it first needs to be instantiated, for example


Dim cbr as ChartBorder
Set cbr = ActiveDocument.Background.Chart.DataTable.Border

Color

Returns or sets the primary color of the object.


ActiveDocument.Background.Chart.DataTable.Border.Color =

ColorIndex

Returns or sets the color of the border. Possible return values are xlColorIndexAutomatic - Automatic color, xlColorIndexNone - No color.

The color is specified as an index value into the current color palette, or as one of the following XlColorIndex constants:


With ActiveDocument.InlineShapes(1) 
 If .HasChart Then 
 With .Chart.Axes(xlValue) 
 If .HasMajorGridlines Then 
 ' Set the color to blue. 
 .MajorGridlines.Border.ColorIndex = 5 
 End If 
 End With 
 End If 
End With

LineStyle

Returns or sets the line style for the border. Read/write XlLineStyle, xlGray25, xlGray50, xlGray75, or xlAutomatic. Possible return values are xlContinuous - A continuous line, xlDash - A dashed line, xlDashDot - Alternating dashes and dots, xlDashDotDot - A dash followed by two dots, xlDot - A dotted line, xlDouble - A double line, xlLineStyleNone - No line, xlSlantDashDot - Slanted dashes.

The xlDouble and xlSlantDashDot constants of the xlLineStyle enumeration do not apply to charts.


With ActiveDocument.InlineShapes(1) 
 If .HasChart Then 
 With .Chart 
 .ChartArea.Border.LineStyle = xlDashDot 
 With .PlotArea.Border 
 .LineStyle = xlDashDotDot 
 .Weight = xlThick 
 End With 
 End With 
 End If 
End With 

Weight

Returns or sets the weight of the border. Read/write XlBorderWeight.


With ActiveDocument.InlineShapes(1) 
 If .HasChart Then 
 .Chart.Axes(xlValue).Border.Weight = xlMedium 
 End If 
End With