Export (0) Print
Expand All
Expand Minimize

Range.BorderAround method

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

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

Object BorderAround(
	Object LineStyle,
	XlBorderWeight Weight,
	XlColorIndex ColorIndex,
	Object Color
)

Parameters

LineStyle
Type: System.Object

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

  • xlContinuousdefault

  • xlDash

  • xlDashDot

  • xlDashDotDot

  • xlDot

  • xlDouble

  • xlLineStlyeNone

  • xlSlantDashDot

  • xlLineStlyeNone

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

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

  • xlHairline

  • xlMedium

  • xlThick

  • xlThindefault

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

Optional 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:

  • xlColorIndexAutomaticdefault

  • xlColorIndexNone

Color
Type: System.Object

Optional Object. The border color, as an RGB 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 don't specify either argument, Microsoft 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.

Community Additions

ADD
Show:
© 2014 Microsoft