O'Reilly logo

Word 2000 in a Nutshell by Walter Glenn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The VBA Editor in Word

We’ve seen some of the syntax and structure of the VBA language. Next we need to examine the Word VBA developer’s environment, the window where you create and modify code. Like the other Office applications, Word uses the Visual Basic Editor as its development environment.

To launch the editor, select Tools Macro Visual Basic Editor in a Word window, or hit Alt-F11. The Microsoft Visual Basic window opens, looking something like Figure 18-5.

The Visual Basic Editor in Word

Figure 18-5. The Visual Basic Editor in Word

The major components of the VBA window are:

  1. Project Explorer. Lists the open projects (templates and documents), with folders for their objects, references, forms and modules.

  2. Immediate Window. Lists statements printed from code using the Debug.Print method.

  3. Properties Sheet. Lists the properties of the selected object (in this case, a UserForm).

  4. Code Window. Shows the code in a module.

  5. UserForm. Shows a UserForm in design view.

  6. Object Browser. Shows the components of the selected object library.

The Project Explorer and Properties Window

The Project Explorer window (the Project-TemplateProject window in Figure 18-5) contains open projects, displayed in a tree structure. To the Word VBA editor, a “project” is any open document (including templates). In Figure 18-3, normal.dot (which doesn’t show in the figure), a document named Chapter 18, another document named Document2, and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required