Microsoft Office Tutorials and References
In Depth Information
19.4.3 The Border Object
19.4.3 The Border Object
The most interesting properties and methods of the Border object are described in this section.
19.4.3.1 Color property
This property returns or sets the primary color of the border. It can also be applied to the Borders
collection to set all vertical and horizontal lines for the borders at the same time. (The property
also applies to Font objects and Interior objects.)
For instance, the following code has the effect shown in Figure 19-22 :
With Range("a1:b4, d2:e2")
.Interior.Color = RGB(196, 196, 196)
With .Borders
.Weight = xlThick
.Color = RGB(255, 0, 0)
End With
End With
Figure 19-22. Assigning the Colors property of the Borders collection
To set a color value, we use the RGB color function, which has the form:
RGB( red , green , blue )
where red , green , and blue are integers between 0 and 255, inclusive, that represent the
strength of the respective color component. Table 19-4 gives some common color values.
Tab le 19-4. Some C ommon Colors
Color
Red
Green
Blue
Black
0
0
0
Blue
0
0
255
Green
0
55 2
0
Cyan
0
55 2
255
Red
255
0
0
Magenta
255
0
255
Yellow
255
55 2
0
White
255
55 2
255
To use a grayscale, set the red, green, and blue components equally. For instance:
RGB(196, 196, 196)
 
 
Search JabSto ::




Custom Search