Collections

I have already hinted at the fact that collections are an essential element in the Office object model. Whenever the model requires more than one of something, it almost always uses a collection to keep track of them. An Excel application can contain more than one workbook, for example, and each workbook can contain multiple worksheets. The Excel Application object therefore contains the Workbooks collection, which contains one Workbook object for each open workbook. Each of these Workbook objects in turn contains a Worksheets collection that contains one Worksheet object for each worksheet in the workbook. Recall that the Office naming conventions always name a collection as the plural of the object type it contains.

Because collections ...

Get Office® XP Development with VBA now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.