Contents

About the Authors

Acknowledgments

Introduction

Chapter 1: Primer in Excel VBA

Using the Macro Recorder

Recording Macros

Running Macros

The Visual Basic Editor

Other Ways to Run Macros

User Defined Functions

Creating a UDF

What UDFs Cannot Do

The Excel Object Model

Objects

Getting Help

Experimenting in the Immediate Window

The VBA Language

Basic Input and Output

Calling Functions and Subroutines

Variable Declaration

Scope and Lifetime of Variables

Variable Type

Object Variables

Making Decisions

Looping

Arrays

Runtime Error Handling

Summary

Chapter 2: Programming in the VBE

Writing Code

Programming for People

Writing Code

Where Does My Code Go?

Managing a Project

Adding Classes

Modifying Properties

Importing and Exporting Visual Basic Code

Editing

Managing Editor Options

Running and Debugging Code

Using Watches

Using the Object Browser

Summary

Chapter 3: The Application Object

Globals

The Active Properties

Display Alerts

Screen Updating

Evaluate

InputBox

StatusBar

SendKeys

OnTime

OnKey

Worksheet Functions

Caller

Summary

Chapter 4: Object-Oriented Theory and VBA

Comparing Classes and Interfaces

Defining an Interface

Implementing an Interface

Defining Methods

Parameters

Implementing Recursive Methods

Eliminating Recursion with Loops

Defining Fields

Defining Properties

Read-Only Properties

Write-Only Properties

Defining Events

Defining Events in Classes

Raising Events

Handling Events

Information Hiding and Access Modifiers

Encapsulation, Aggregation, and References

Summary ...

Get Excel 2003 VBA Programmer's Reference 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.