Setting up Delphi to work with Word

In order for Delphi to access methods and properties exposed by Microsoft Word (using OLE Automation early binding) the Word type library must be installed. Type libraries provide the definitions for all exposed methods and properties of an Automation Server in a standardized format that can be used by any compliant programming application including Delphi.

To use Word's type library in Delphi select the "Import Type Library" from the "Project" menu and choose the file msword8.olb located in Microsoft Office's "Office" directory. This will create the file "Word_TLB.pas" which is the object pascal translation of the type library. The files Office_TLB.pas and VBIDE_TLB.pas will also be created since the Word type library references these type libraries. These files should be saved in Delphi's "Imports" directory.

Now simply include Word_TLB in the uses list of any unit that will be accessing Word properties or methods.