Listing An Alternative Approach to Listing

Sub BorderLineSytlesII()

Dim rg As Range

Set rg = ThnsWorkbook.WorksheetsC'Borders"). Range("LineStyleListStart")

rg

Offset(1,

2)

Borders(xl

EdgeBottom)

Li

neStyle

= xl

Continuous

rg

Offset(2,

2)

Borders(xl

EdgeBottom)

Li

neStyle

= xl

Dash

rg

Offset(3,

2)

Borders(xl

EdgeBottom)

Li

neStyle

= xl

DashDot

rg

Offset(4,

2)

Borders(xl

EdgeBottom)

Li

neStyle

= xl

DashDotDot

rg

Offset(5,

2)

Borders(xl

EdgeBottom)

Li

neStyle

= xl

Dot

rg

Offset(6,

2)

Borders(xl

EdgeBottom)

Li

neStyle

= xl

Double

rg

Offset(7,

2)

Borders(xl

EdgeBottom)

Li

neStyle

= xl

LineStyleNone

rg

Offset(8,

2)

Borders(xl

EdgeBottom)

Li

neStyle

= xl

SlantDashDot

Set rg = Nothing End Sub

Hopefully if I lost you by using the values of the constants rather than specifying the names of each constant in the examples in this chapter, it is all clear now.

As I mentioned at the beginning of this section, the Range object also has a method associated with it called BordersAround; you can use it to create a border around a range.

SomeRangeObject.BordersAround [LineStyle], [Weight], _ [ColorIndex], [Color]

Figure 10.8

A visual representation of the XLLine-Style constants

Figure 10.8

A visual representation of the XLLine-Style constants

ES Microsoft Office Encel 2003 Bela

-diopter to EHamplesjds

se®

1 File Edit View

insert Format Tools ' V- Window nNn

-5x1

p : 10 - B 1

■ ■ »

■ lSUI I * # 1 S •

^ * Ä - -1

J

1: J —! "¿J .

jia x

1^1 ■'■■■. 1 r-err, ijiir g-üigei..

Ett - ft

A

B

. C D e|

F ir

1

XLËoiclersImlex Constants

2

Constant

Value

Example

3

xlDiagonalDoMi

S

1

4

xlDiagtmalUp

6

S

xlEdgeBottom

9

G

KlEdgeLsft

7'

_L

7

xlEdgeRight

t

a

>:lEdgeTojj

a

3

10

11

XLLine5tyle Constants

1 !

1

12

Constant

Value

Example

13

¡(¡Continuous

1

14

xDash

-4115

15

ïlDashDot

4

16

sIDashDotDot

S

17

ilDot

-4110

16

klDoobls

-4119

10

xlLineStyleNone

-4142

20

sISIantDashDol

13

21

■n

V

M i

i H Ii Interior ^Borders /Nurr 1 <

> 1

I Beady

The parameters of the BordersAround method are described in the following list.

LineStyle The line style for the border. You can either use the LineStyle parameter or the Weight parameter, not both. Choose from one of the XLLineStyle constants shown in Figure 10.8.

Weight The weight, or thickness of the border. You can either use the LineStyle parameter or the Weight parameter, not both. Choose from one of the XLBorderWeight constants: xlHairline, xlMedium, xlThick, or xlThin (default).

Colorlndex The color of the border using an index that indicates which of the color palette's colors to use. If you supply the ColorIndex, don't supply the Color parameter.

Color The color of the border using a RGB value. If you supply the Color, don't supply the Col-orIndex parameter.

0 0

Post a comment