Class Border (Excel VBA)

The class Border represents the border of an object.

The classes Axis, DataTable, DropLines, ErrorBars, Gridlines, HiLoLines, LeaderLines, OLEObject, Range, SeriesLines and Trendline. give access to class Border

Member in collection

Item

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 and Trendline.Border.

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

Borders.Item (Default member) - Returns a Border object that represents one of the borders of either a range of cells or a style.

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.

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.LineStyle returns or sets the line style for the border. Read/write XlLineStyle, xlGray25, xlGray50, xlGray75, or xlAutomatic.

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.