Topics in Learning Excel Programming

In general, the education of an Excel programmer breaks down into a few main categories, as follows.

The Visual Basic Editor

First, you need to learn a bit about the environment in which Excel programming is done. This is the so-called Visual Basic Editor or Excel VBA Integrated Development Environment (IDE for short). We take care of this in Chapter 3 and Chapter 4.

The Basics of Programming in VBA

Next, you need to learn a bit about the basics of the programming language that Excel uses. This language is called Visual Basic for Applications (VBA). Actually, VBA is used not only by Microsoft Excel, but also by the other major components in the Microsoft Office application suite: Access, Word, and PowerPoint. Any application that uses VBA in this way is called a host application for VBA. (There are also a number of nonMicrosoft products that use VBA as their underlying programming language. Among the most notable is Visio, a vector-based drawing program.) It is also used by the standalone programming environment called Visual Basic (VB).

We will discuss the basics of the VBA programming language in Chapter 5 through Chapter 8.

Object Models and the Excel Object Model

Each VBA host application (Word, Access, Excel, PowerPoint, Visual Basic) supplements the basic VBA language by providing an object model to deal with the objects that are particular to that application.

For instance, Excel VBA includes the Excel object model, which deals with such objects as workbooks, worksheets, cells, rows, columns, ranges, charts, pivot tables, and so on. On the other hand, the Word object model deals with such objects as documents, templates, paragraphs, fonts, headers, tables, and so on. Access VBA includes two object models, the Access object model and the DAO object model, that allow the programmer to deal with such objects as database tables, queries, forms, and reports. (To learn more about the Word, Access, and DAO object models, see my books Learning Word Programming and Access Database Design and Programming, also published by O'Reilly.)

Thus, an Excel programmer must be familiar with the general notion of an object model and with the Excel object model in particular. We discuss object models in general in Chapter 9, and our discussion of the Excel object model takes up most of the remainder of the book.

Incidentally, the Excel object model is quite extensive—a close second to the Word object model in size and complexity, with almost 200 different objects.

Lest you be too discouraged by the size of the Excel object model, I should point out that you only need to be familiar with a handful of objects to program meaningfully in Excel VBA. In fact, as we will see, the vast majority of the "action" is related to just seven objects: Application, Range, WorksheetFunction, Workbook, Worksheet, PivotTable, and Chart.

To help you get an overall two-dimensional picture of the Excel object model, as well as detailed local views, I have written special object browser software. (The object browser comes with over a dozen other object models as well.) For more information, please visit http://www.romanpress.com.

Whether you are interested in Excel programming to be more efficient in your own work or to make money writing Excel programs for others to use, I think you will enjoy the increased sense of power that you get by knowing how to manipulate Excel at the programming level. And because Excel programming involves accessing the Excel object model by using the Visual Basic for Applications programming language—the same programming language used in Microsoft Word, Access, and PowerPoint—after reading this book, you will be half-way to being a Word, Access, and PowerPoint programmer as well!

0 0

Post a comment