Chapter 5: Introducing Visual Basic for Applications

In This Chapter

• Introducing VBA — the programming language built into Excel

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

• Using Visual Basic Editor (VBE)

• Working in the code windows in VBE and customizing the VBE environment

• Using Excel's macro recorder

• Getting an overview of objects, collections, properties, and methods

• Reviewing a case study of the Comment object

• Looking at specific information and examples of working with Range objects

• Accessing a lot of information about Excel objects, properties, and methods

Getting 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 BASIC isn't 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. Most modern dialects of BASIC allow the code to be compiled — converted to machine code — which results in faster and more efficient execution.

BASIC gained quite a bit of respectability in 1991 when Microsoft ...

Get Excel 2013 Power Programming with VBA now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.