It's easy to get so involved polishing your application from a programmatic standpoint that you neglect the part most noticeable to users—the look. Though it may seem trivial, the formatting of your various worksheets can go a long way toward influencing how your hard work is perceived by your end users. Therefore, it pays to make sure you give this area some attention and don't downplay these issues.

One way that you can spice up a worksheet is by applying color to its various components. You can color fonts, cell interiors, gridlines, drawing objects, and all of the visual chart-related objects and borders, among other things. Any object that has a Color property also contains a ColorIndex property. The difference is that you can specify Color using an RGB value, whereas you specify Color-Index using an index that refers to a color occupying the workbook's color palette.

Other ways that you can dress up a worksheet include using a pleasing mix of fonts (Font.Name), font sizes (Font.Size), interior patterns (Interior.Pattern), and borders. To apply these effects, use the appropriate object and property applied to a given Range object. Oh, and don't forget about those number formats. You can set them using the NumberFormat property of the Range object.

Regarding charts, although you can create them on the fly, it is best to create charts during the development process and then use them as templates, so to speak. This is because creating visually pleasing charts requires an iterative design process that requires your visual senses—a task that can't be replaced by a computer.

The conclusion of this chapter marks the end of the Excel object model section of this book. The next section covers some more advanced topics including interacting with external programs, developing class modules, adding user personalization, and some Excel development best practices. I'll kick this section off with a chapter that teaches you how to create and use your own classes.

0 0

Post a comment