Chapter 3. The Visual Basic Editor, Part I

In this chapter:

  • The Project Window

  • The Properties Window

  • The Code Window

  • The Immediate Window

  • Arranging Windows

  • Document Events

The first step in becoming a Word VBA programmer is to become familiar with the environment in which Word VBA programming is done. Each of the main Office applications has a programming environment referred to as its Integrated Development Environment or IDE. Microsoft also refers to this programming environment as the Visual Basic Editor.

My plan in this chapter and the next is to describe the major components of the Word IDE. I realize that you are probably anxious to get to some actual programming, but it is necessary to gain some familiarity with the IDE before you can use it. Nevertheless, you may want to read quickly through this chapter and the next and then refer to them as needed.

The Word, Excel, and PowerPoint IDEs have the same appearance, shown in Figure 3-1. (The Microsoft Access IDE has a different appearance.) To start the Word IDE, simply choose Visual Basic Editor from the Macros submenu of the Tools menu or press Alt-F11.

The Project Window

The window in the upper-left corner of the client area (below the toolbar) is called the Project Explorer. Figure 3-2 shows a close-up of this window.

Note that the Project Explorer has a treelike structure, similar to the Windows Explorer’s folders pane (the lefthand pane). Each entry in the Project Explorer is called a node. The top nodes, of which ...

Get Writing Word Macros, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.