Border Object [Excel 2003 VBA Language Reference]
Multiple objects Border |
Represents the border of an object.
Using the Border Object
Most bordered objects (all except for the Range and Style objects) have a border that's treated as a single entity, regardless of how many sides it has. The entire border must be returned as a unit. Use the Border property to return the Border object for this kind of object. The following example activates the chart sheet named Chart1 places a dashed border around the chart area for the active chart and places a dotted border around the plot area.
Charts("chart1").Activate
With ActiveChart
.ChartArea.Border.LineStyle = xlDash
.PlotArea.Border.LineStyle = xlDot
End With
Range and Style objects have four discrete borders — left, right, top, and bottom — which can be returned individually or as a group. Use the Borders property to return the Borders collection, which contains all four borders and treats the borders as a unit. The following example adds a double border to cell A1 on worksheet one.
Worksheets(1).Range("A1").Borders.LineStyle = xlDouble
Use Borders(index), where index identifies the border, to return a single Border object. The following example sets the color of the bottom border of cells A1:G1.
Worksheets("Sheet1").Range("A1:G1"). _
Borders(xlEdgeBottom).Color = RGB(255, 0, 0)
Index can be one of the following XlBordersIndex constants: xlDiagonalDown, xlDiagonalUp, xlEdgeBottom, xlEdgeLeft, xlEdgeRight, xlEdgeTop, xlInsideHorizontal, or xlInsideVertical.
Properties | Application Property | Color Property | ColorIndex Property | Creator Property | LineStyle Property | Parent Property | Weight Property
Parent Objects | Axis Object | AxisTitle Object | Borders Collection | ChartArea Object | ChartObject Object | ChartObjects Collection | ChartTitle Object | DataLabel Object | DataLabels Collection | DataTable Object | DisplayUnitLabel Object | DownBars Object | DropLines Object | ErrorBars Object | Floor Object | Gridlines Object | HiLoLines Object | LeaderLines Object | Legend Object | LegendKey Object | OLEObject Object | OLEObjects Collection | PlotArea Object | Point Object | Series Object | SeriesLines Object | Trendline Object | UpBars Object | Walls Object
Child Objects