This documentation is archived and is not being maintained.

LineStyle Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Returns or sets the border line style for the specified range. Can be one of the LineStyleEnum constants; returns Null if the borders do not all have the same style. Use the IsNull function to determine whether the return value is Null. Read/write Variant.


expression   Required. An expression that returns one of the objects in the Applies To list.


You cannot set this property for a ChBorder object that represents a chart element.


This example puts a green dash-dot border around each cell in the range A1:E5.

Sub SetBorder()

   Dim rngCurrent
   Dim ssConstants

   Set ssConstants = Spreadsheet1.Constants

   Set rngCurrent = Spreadsheet1.Range("a1:e5")

   rngCurrent.Borders.LineStyle = ssConstants.owcLineStyleDashDot

   rngCurrent.Borders.Color = "Green"

End Sub