The Need for Persistence

Because your code lives in a workbook, why not store user settings there? In fact, why stop with user settings? Why not put any configurable setting on a worksheet where it can be easily modified as needed? You'll encounter certain situations in which this is not a good idea or not practical, but for many Excel applications this is a useful way to store this information in a manner that is easy and portable (the settings "travel" with the workbook). By portable, I mean that the workbook doesn't have any dependencies on other files or registry entries or anything else external to the workbook file.

You may want to think about storing many nuggets of information. Basically, any constant or semi-constant value in your code can be pulled out of the VBE and onto a worksheet. When you put this information on a worksheet, you're able to change the behavior of your application without getting knee-deep in the code. Some people refer to this type of programming as table-driven programming. One of the benefits of this method of programming is that you don't have to be a programmer to change the configuration of the program and thus its behavior.

In order to facilitate this type of programming, I've created a few easy-to-use classes. The Setting class is the primary class that allows you to manipulate Setting objects. The Settings class is a pseudocollection class that manages a collection of Setting objects.

0 0

Post a comment