1197
Code Snippets You Can Use
The .Format = True setting in the Find loop in Listing 44.6 ensures that Word looks for
paragraphs with the specified formatting.
Using VBA to Loop Through Collections
VBA abounds with collections. All the files currently open in an application, for example,
define one common collection. Other collections include all the bookmarks in a document,
or all the named ranges in a workbook.
Sometimes you know exactly which member of a collection you’re trying to find. For exam-
ple, the VBA/Excel command
Workbooks(“Book1.xls”).Activate
scans the Workbooks collection, and brings up the workbook called Book1.xls.
At other times, however ...