Border (object)

<< Click to Display Table of Contents >>

Border (object)

Access paths:

Application à Workbooks à Item à Sheets à Item à Range à Borders à Item

Application à Workbooks à ActiveSheet à Range à Borders à Item

Application à ActiveWorkbook à ActiveSheet à Range à Borders à Item

Application à ActiveSheet à Range à Borders à Item

Instead of Range, you can also use other objects and properties that return a Range object: ActiveCell, Selection, Rows(n), Columns(n) and Cells(x, y). You can find examples of these access paths in the Range-Object.

 1  Description

A Border object represents one of the border lines of cells (e.g. the upper, lower, left or right line). You can use this object to get or change the line settings (thickness, color, etc.) of a border line.

 2  Access to the object

The individual Border objects can only be accessed via the Borders collection. As a child object of a Range object, BordersItem(n) represents a border line of the cells in this range, corresponding to the ribbon command Home | Format group | Borders.

To specify which of the lines in a Borders collection you want to edit (left, right, top, bottom, etc.), pass the number of that line (or the corresponding constant) as a parameter according to the following table:

pmBorderTop        = -1 ' Top border line

pmBorderLeft       = -2 ' Left border line

pmBorderBottom     = -3 ' Bottom border line

pmBorderRight      = -4 ' Right border line

pmBorderHorizontal = -5 ' Horizontal grid lines

pmBorderVertical   = -6 ' Vertical grid lines

Example:

' Draw a bottom border for the cell A1

pm.ActiveSheet.Range("A1").Borders(pmBorderBottom).Type = pmLineStyleSingle

 3  Properties, objects, collections and methods

Properties:

Type (default property)

Thick1

Thick2

Separator

Color

ColorIndex

 

Objects:

Application Application

Parent Borders

Type (property)

Data type: Long (PmLineStyle)

Gets or sets the type of the border line. The possible values are:

pmLineStyleNone   = 0 ' No border

pmLineStyleSingle = 1 ' Simple border

pmLineStyleDouble = 2 ' Double border

Thick1 (property)

Data type: Single

Gets or sets the thickness of the first border line in points (1 point corresponds to 1/72 inches).

Thick2 (property)

Data type: Single

Gets or sets the thickness of the second border line in points (1 point corresponds to 1/72 inches).

This property is used only if the type of the border is set to pmLineStyleDouble.

Thick1, Thick2 and Separator taken together may not be greater than 12.

Separator (property)

Data type: Single

Gets or sets the offset between two border lines in points (1 point corresponds to 1/72 inches).

This property is used only if the type of the border is set to pmLineStyleDouble.

Thick1, Thick2 and Separator taken together may not be greater than 12.

Color (property)

Data type: Long (SmoColor)

Gets or sets the color of the border line(s) as a "BGR" value (Blue-Green-Red triplet). You can either indicate an arbitrary value or use one of the pre-defined BGR color constants.

ColorIndex (property)

Data type: Long (SmoColorIndex)

Gets or sets the color of the border line(s) as an index color. "Index colors" are the standard colors of PlanMaker, consecutively numbered from 0 for black to 15 for light gray. You may use the values shown in the Index colors table.

Note: It is recommended to use the Color property (see above) instead of this one, since it is not limited to the standard colors but enables you to access the entire BGR color palette.

Application (pointer to object)

Data type: Object

Returns the Application object.

Parent (pointer to object)

Data type: Object

Returns the parent object, i.e. an object that is of the type Borders.