The CDO Object Model

The CDO object model contains 23 classes. These classes are defined in the type library contained in the file cdo.dll. This type library also contains the declarations of these classes’ numerous properties, methods, and constants. (CDO objects don’t expose any events.) The remainder of this chapter examines the relationships among the CDO classes, and briefly describes the most important of their methods, etc. Throughout the remainder of the book, these features will be examined in detail. It should be noted that cdo.dll contains more than just the type library for CDO; it also contains the executable code that implements CDO’s features.

The first order of business is to set a reference to the CDO type library. From the Visual Basic menu, choose Project References to display the References dialog box (already shown in Figure 5-1). Scroll down the list of available references until you find “Microsoft CDO version number Library,” where version number should be 1.x in order to work with the samples in this book. Select this item if it’s not already selected, and click OK.


If you don’t find “Microsoft CDO 1.21 Library” in your list of available references, either you don’t have cdo.dll on your system or it hasn’t been registered (i.e., the location of this file hasn’t been noted in the Windows Registry). Search your local hard drive(s) for cdo.dll. If you find it, return to the References dialog box and click Browse. Browse to cdo.dll and click Open, then ...

Get CDO & MAPI Programming with Visual Basic: 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.