1.1. What Is VBA?

Visual Basic for Applications is a hosted language and part of the Visual Basic family of development tools. Although VBA can be thought of as sitting below the retail version of VB and above VBScript in the VB hierarchy, VBA is actually an essential element of the retail version of VB, providing the vast majority of language elements used in VB. When hosted in VB, VBA provides language support and an interface for forms, controls, objects, modules, and data-access technologies. When hosted in other applications such as Word or Excel, VBA, using a technology called automation , provides the means of interacting with and accessing the host application's object model, as well as the object models of other applications and components.

In order to customize complex applications such as Excel, Word, Access, and a growing number of other applications from Microsoft and other vendors, VBA allows the developer to provide solutions that take advantage of sophisticated components that have been tried and tested. VBA is a glue language: a language that interfaces with the various objects that make up an application via the host application's object model. VBA is the means by which applications can become extensible, and it's ActiveX (or OLE automation) that provides the interface between VBA and its host application. It's this support for OLE automation that makes VBA an outstanding tool for rapidly developing robust Windows applications.

Until the launch of VBA 5.0 in ...

Get VB & VBA in a Nutshell: The Language 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.