Custom Property Object and the Custom Properties Collection

This object allows you to store information within a worksheet or SmartTag. This information can then be used as metadata for XML, or can be accessed by any routine that needs information specific to the worksheet or SmartTag.

More important to a developer is the capability of this new object to store specifics regarding a worksheet or group of worksheets so any routine can call up the CustomProperty, analyze the information contained within, and then make decisions on how to handle that worksheet. In the past, many developers used worksheet-level range names to store information about a worksheet. Worksheet-level range names only reside in that worksheet, enabling each worksheet to have the same range name, but store different values.

For example, each worksheet in a workbook containing a dozen budget worksheets and three report worksheets could contain the same range name, called IsBudget. All of the budget sheets would store the value of True in the range name, while the report sheets would store False. Routines that need to loop through the worksheets, applying different formats or calculations to budget sheets, can call on the value of the range name to determine if it's a budget sheet before running code on it.

This new CustomProperty object makes storing such information (or any information, for that matter) simpler than creating worksheet-level range names, or storing such information in a hidden worksheet or in the Registry.

The CustomProperties collection represents CustomProperty objects for either worksheets or SmartTags. CustomProperties can store information within either a worksheet or SmartTag. They are similar to the DocumentProperties object in the Office XP model, except they are stored with a worksheet or SmartTag instead of the whole document.

0 0

Post a comment