Early Binding

Code written with early binding executes faster than code with late binding. A reference is made to Word's object library before the code is written so that Word's objects, properties, and methods are available in the Object Browser. Tips also appear as shown in Figure 16.1, such as a list of members of an object.

The disadvantage of early binding is that the referenced object library must exist on the system. For example, if you write a macro referencing Word 2003's object library and someone with Word 2002 attempts to run the code, the program fails because the program cannot find the 2003 object library.

Figure 16.1

Early binding allows easy access to the Word object's syntax.

Figure 16.1

Early binding allows easy access to the Word object's syntax.

The object library is added through the VBE:

1. Select Tools, References.

2. Check Microsoft Word 11.0 Object Library in the Available References list (see Figure 16.2).

0 0

Post a comment