What Is VBA?

VBA is a subset of the Visual Basic programming language. It is a hosted language component, meaning that an application provides the environment in which VBA code is written and executed. Word 2000 is one such application.

Each Office application has a slightly different flavor of VBA. The basic language is the same, but is extended with extra components through the host application’s object model. An object model is a hierarchy of logical entities (objects) representing components of the application, such as a document in Word or a worksheet in Excel. By using an application’s object model (explained later in this chapter), you can programmatically perform standard application functions, like text formatting, as well as more complex tasks, some of which may require interaction with the user.

You can even use VBA in one Office application to control another Office application using Automation code. This allows you to write programs that integrate the capabilities of several Office components. Some of the code samples in this chapter illustrate working with another application (Access or Outlook) from Word VBA code, though a full discussion of inter-Office Automation programming is beyond the scope of this book.

See "Microsoft Office 2000/Visual Basic Programmer’s Guide” (http://msdn.microsoft.com/library/officedev/odeopg/deovroffice2000visualbasicprogrammersguide.htm) for more information on Visual Basic and Office 2000. This document is included in printed form ...

Get Word 2000 in a Nutshell 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.