Table of Contents

Preface vii

Part I: The Basics

Chapter 1—Introduction 3

A Brief History of VBA 6

Object Models: The Power of Programming with VBA 8

Chapter 2—Program Structure 11

Getting a VB Program to Run 12

The Structure of a VB Program 19

Ending Your VB Program 23

Chapter 3—VBA Variables and Data Types 26

Visual Basic Data Types 26

Type Conversion 31

The Variant 33

Declaring Variables and Constants 37

Array Variables 39

User-Defined Types 45

Variable Scope and Lifetime 46

Object Variables and Binding 47

Passing Parameters 50

Intrinsic Constants 53

Chapter 4—Class Modules 54

Properties 55

Enumerated Constants 62

Class Module Events 63

Implementing Custom Class Methods 68

Creating ActiveX Components 70

Using ActiveX Components in a Project 75

Chapter 5—Automation 77

Creating Object Model References 77

Reading the Object Model 79

Working with the Object Model 81

Collection Objects 83

Trapping an Automation Server's Events 84

Automation Examples 85

Automation Performance Tips 89

Chapter 6—Error Handling 91

Building a Robust Application 92

Error Handling in Procedures 95

Error Handling in ActiveX Servers 101

Reporting Errors 104

Part II: Reference

Chapter 7—The Language Reference 111

Part III: Appendixes

Appendix A—Language Elements by Category 583

Appendix B—Language Constants 598

Appendix C—Operators 606

Index 617

Was this article helpful?

0 0

Post a comment