NamedRange.BorderAround2 Method (Object, XlBorderWeight, XlColorIndex, Object, Object)

 

Adds a border to a NamedRange control and sets the Color, LineStyle, and Weight properties for the new border.

Namespace:   Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

object BorderAround2(
	object LineStyle,
	XlBorderWeight Weight = XlBorderWeight.xlThin,
	XlColorIndex ColorIndex = XlColorIndex.xlColorIndexAutomatic,
	object Color,
	object ThemeColor
)

Parameters

LineStyle
Type: System.Object

The line style for the border. Can be one of the following XlLineStyle values:

xlContinuous

xlDash

xlDashDot

xlDashDotDot

xlDot

xlDouble

xlSlantDashDot

xlLineStyleNone

Weight
Type: Microsoft.Office.Interop.Excel.XlBorderWeight

The border weight. Can be one of the following XlBorderWeight constants:

xlHairline

xlMedium

xlThick

xlThin

ColorIndex
Type: Microsoft.Office.Interop.Excel.XlColorIndex

The border color, as an index into the current color palette or as an XlColorIndex constant. Can be one of the following XlColorIndex constants:

xlColorIndexAutomatic

xlColorIndexNone

Color
Type: System.Object

The border color, as an RGB value.

ThemeColor
Type: System.Object

The theme color, as an index into the current color theme or as an XlThemeColor value.

Return Value

Type: System.Object

You must specify either ColorIndex or Color, but not both.

You can specify either LineStyle or Weight, but not both. If you do not specify either argument, Microsoft Office Excel uses the default line style and weight.

This method outlines the entire range without filling it in. To set the borders of all the cells, you must set the Color, LineStyle, and Weight properties for the Borders collection. To clear the border, you must set the LineStyle property to xlLineStyleNone for all the cells in the range.

Return to top
Show: