How This Book Is Organized

The chapters in this book describe major feature areas of Visual Basic and techniques for using those features. The first three chapters — "Modules and Procedures," "Variables, Constants, and Data Types," and "Controlling Program Flow" — provide an introduction to the mechanics of writing Visual Basic code.

Chapter 4, "Objects and Collections," discusses the Microsoft Excel object model in detail and gives useful examples of manipulating and referencing objects to accomplish tasks in Visual Basic macros.

Chapter 5, "Optimizing for Size and Speed," shows you several easy techniques that can make your Visual Basic code faster and more concise.

Chapter 6, "Debugging," and Chapter 7, "Handling Run-Time Errors," show you how to find and eliminate bugs in your code before you run it and how to handle errors that occur while your code is running.

Chapter 8, "Controls and Dialog Boxes," and Chapter 9, "Menus and Toolbars," show you how to add custom user-interface elements to your Visual Basic macros.

Chapter 10, "Communicating with Other Applications," details using OLE Automation to communicate with and control other applications.

Chapter 11, "Automatic Procedures and OnEvent Procedures," shows you how to write procedures that run whenever a specific event — such as opening a workbook or clicking a control — occurs.

Chapter 12, "Creating Add-Ins," provides information about creating and using add-ins to distribute your macros.

Chapter 13, "Accessing External Data," discusses using Data Access Objects (DAOs) to import and export information stored in a database.

Appendixes A through D explain how to write international applications, provide helpful information for experienced Microsoft Excel users who are switching to Visual Basic, list all the toolbar buttons in Microsoft Excel, and diagram the Microsoft Excel object model.