The CDC class 

There are reports of problems using the CommonDialog control with different platforms and that Microsoft has declared it to be 'unsafe'!

There are certainly problems when trying to use it with Office 2003, VBA applications running under XP.

Several codings are available to replace the CD control with API calls and this class is based on code from a number of sources.

The CDC_class class has the following self-explanitory methods,


It has one property, FontData, which can be used to return the selected font size, colour, etc.

The demonstration allows the use of each of the methods.

A complete set of constants is included for all aspects of the API calls even 'though some aren't used by the existing code. I found some values so difficult to find that I decided to include them all.

The ShowPrinter method applies the specified data to the selected printer: the other methods require the main program to do this.

A modified version of the class, CDC_Excel_class, is included as a text file for use with VBA code but this is not recommended as there is little control over a printer from VBA as a Printer object can't be defined.