Chapter 7. Introducing Visual Basic for Applications

In This Chapter

This chapter introduces you to Visual Basic for Applications (VBA) and the objects that make up Excel.

  • An introduction to VBA — the programming language built into Excel

  • How VBA differs from traditional spreadsheet macro languages and how it differs from the Visual Basic language

  • How to use the Visual Basic Editor (VBE)

  • How to work in the Code windows in the VBE and customize the VBE environment

  • How to use Excel’s macro recorder

  • An overview of objects, collections, properties, and methods

  • A case study of the Comment object

  • Specific information and examples of working with Range objects

  • How to access a lot of information about Excel objects, properties, and methods

Programming Excel essentially boils down to manipulating objects, which you do by writing instructions in a language that Excel can understand: VBA.

Some BASIC Background

Many hard-core programmers scoff at the idea of programming in BASIC. The name itself (an acronym for Beginner’s All-purpose Symbolic Instruction Code) suggests that it’s not a professional language. In fact, BASIC was first developed in the early 1960s as a way to teach programming techniques to college students. BASIC caught on quickly and is available in hundreds of dialects for many types of computers.

BASIC has evolved and improved over the years. For example, in many early implementations, BASIC was an interpreted language. Each line was interpreted before it was executed, causing slow performance. ...

Get Excel® 2007 Power Programming with VBA 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.