The Office/Visual Basic Relationship

Visual Basic for Applications is a combination of an integrated programming environment (the Visual Basic Editor) and the Visual Basic programming language. This combination allows you to easily design and develop Visual Basic programs. The term "for Applications" refers to the fact that the Visual Basic programming language and the development tools in the Visual Basic Editor are seamlessly integrated with all Office applications so that you can develop custom functionality and feature solutions using these applications.

The Visual Basic Editor

Each document, workbook, presentation, or database you open in Word, Excel, PowerPoint, or Access respectively has an associated Visual Basic for Applications project. When you open a workbook in Excel, for example, an associated Visual Basic project is listed in the Project Explorer window of the Visual Basic Editor. To write Visual Basic code in the Excel workbook's Visual Basic for Applications project, you must display the Visual Basic Editor. One way to display it is to point to Macro on the Tools menu, and then click Visual Basic Editor on the submenu.

Click to view at full size.

All the applications in Office provide the same integrated development environment. The Visual Basic Editor contains all the programming tools you need to write Visual Basic code and create custom solutions. For example, you can switch to the Visual Basic Editor window from PowerPoint the same way you do from Excel (from the Tools menu, point to Macro, and then click Visual Basic Editor).

Click to view at full size.

Although the Editor is a separate window in all Office applications, it looks and functions identically in each one. Thus, you can potentially have three Visual Basic Editor windows open at one time, each one associated with a separate application. When you close a given application, its associated Visual Basic Editor window closes automatically.

Examining the Elements of the Visual Basic Editor

The Visual Basic Editor provides a number of advanced programming and development tools that were once found only in development programs like Microsoft Visual C++.