Class Border (Excel VBA)

The class Border represents the border of an object.

Set

To use a Border class variable it first needs to be instantiated, for example

Dim brd as Border
Set brd = ActiveCell.BorderAround()

The following procedures can be used to set variables of type Border: Axis.Border, Borders.Item, DataTable.Border, DropLines.Border, ErrorBars.Border, Gridlines.Border, HiLoLines.Border, LeaderLines.Border, OLEObject.Border, OLEObjects.Border, Range.BorderAround, SeriesLines.Border, Trendline.Border, AboveAverage.Borders, CellFormat.Borders, DisplayFormat.Borders, FormatCondition.Borders, Range.Borders, Style.Borders, TableStyleElement.Borders, Top10.Borders and UniqueValues.Borders

For Each

Here is an example of processing the Border items in a collection.

Dim brd As Border
For Each brd In Application.Borders
	
Next brd

Properties

Color returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value.

ColorIndex returns or sets a value that represents the color of the border.

LineStyle returns or sets the line style for the border. Read/write XlLineStyle, xlGray25, xlGray50, xlGray75, or xlAutomatic.

Parent returns the parent object for the specified object. Read-only.

ThemeColor returns or sets the theme color in the applied color scheme that is associated with the specified object.

TintAndShade returns or sets a Single that lightens or darkens a color.

Weight returns or sets an XlBorderWeight value that represents the weight of the border.

Borders.Color returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value.

Borders.ColorIndex returns or sets a value that represents the color of all four borders.

Borders.Count returns a Long value that represents the number of objects in the collection.

Borders.Item returns a Border object that represents one of the borders of either a range of cells or a style.

Borders.LineStyle returns or sets the line style for the border. Read/write XlLineStyle, xlGray25, xlGray50, xlGray75, or xlAutomatic.

Borders.Parent returns the parent object for the specified object. Read-only.

Borders.ThemeColor returns or sets the theme color in the applied color scheme that is associated with the specified object.

Borders.TintAndShade returns or sets a Single that lightens or darkens a color.

Borders.Value synonym for Borders.LineStyle.

Borders.Weight returns or sets an XlBorderWeight value that represents the weight of the border.