Figure

The Font object contains properties that represent all of the items found on the Font tab of the Format Cells dialog box.

Most of the properties that correspond to items found on the Font tab of the Format Cells dialog box are named exactly the same. For example, the Font object has properties named Color, Size, and Underline. The most common properties of the Font object are shown in Table 10.2.

Table 10.2: Common Properties of the font Object

Property Name

Description

Bold

Set to true to make the font bold or false to turn bold off.

Color

Returns or sets the color of the font using an RGB value.

ColorIndex

Returns or sets the color of the font using a color from the workbook's color palette.

FontStyle

Returns or sets the font style.

Italic

Set to true to make the font italic or false to turn italic off.

Name

Returns or sets the name of the font.

Size

Returns or sets the size of the font in points.

Underline

Returns or sets the type of underline used by the font. Choose from

xlUnderlineStyleNone, xlUnderlineStyleSingle, xlUnderlineStyleDouble,

xlUnderlineStyleSingleAccounting, or xlUnderlineStyleDoubleAccounting.

No real surprises here, no tricks to learn and no gotchas. Take a look at Listing 10.2 for a simple example that uses the Font object.

0 0

Post a comment