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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.