Share via


NamedRange.BorderAround2 Method

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)

Syntax

'Declaration
Function BorderAround2 ( _
    LineStyle As Object, _
    Weight As XlBorderWeight, _
    ColorIndex As XlColorIndex, _
    Color As Object, _
    ThemeColor As Object _
) As Object
Object BorderAround2(
    Object LineStyle,
    XlBorderWeight Weight,
    XlColorIndex ColorIndex,
    Object Color,
    Object ThemeColor
)

Parameters

  • 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

Remarks

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.

.NET Framework Security

See Also

Reference

NamedRange Interface

Microsoft.Office.Tools.Excel Namespace