Range.BorderAround(Object, XlBorderWeight, XlColorIndex, Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public object BorderAround (object LineStyle, Microsoft.Office.Interop.Excel.XlBorderWeight Weight = Microsoft.Office.Interop.Excel.XlBorderWeight.xlThin, Microsoft.Office.Interop.Excel.XlColorIndex ColorIndex = Microsoft.Office.Interop.Excel.XlColorIndex.xlColorIndexAutomatic, object Color);
Public Function BorderAround (Optional LineStyle As Object, Optional Weight As XlBorderWeight = Microsoft.Office.Interop.Excel.XlBorderWeight.xlThin, Optional ColorIndex As XlColorIndex = Microsoft.Office.Interop.Excel.XlColorIndex.xlColorIndexAutomatic, Optional Color As Object) As Object
Parameters
- LineStyle
- Object
Optional XlLineStyle. The line style for the border. Can be one of the following XlLineStyle constants:xlContinuousdefault
xlDashxlDashDotxlDashDotDotxlDotxlDoublexlLineStlyeNonexlSlantDashDotxlLineStlyeNone
- Weight
- XlBorderWeight
Optional XlBorderWeight. The border weight. Can be one of the following XlBorderWeight constants:xlHairlinexlMediumxlThickxlThindefault
- ColorIndex
- 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
- Object
Optional Object. The border color, as an RGB value.
Returns
Remarks
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.