Dear Reader

Thank you for choosing Mastering VBAfor Microsoft Office 2007. This book is part of a family of premium quality Sybex books, all written by outstanding authors who combine practical experience with a gift for teaching.

Sybex was founded in 1976. More than thirty years later, we're still committed to producing consistently exceptional books. With each of our titles we're working hard to set a new standard for the industry. From the authors we work with, to the paper we print on, our goal is to bring you the best books available.

I hope you see all that reflected in these pages. I'd be very interested to hear your comments and get your feedback on how we're doing. Feel free to let me know what you think about this or any other Sybex book by sending me an email at [email protected], or if you think you've found a technical error in this book, please visit http://sybex.custhelp.com. Customer feedback is critical to our efforts at Sybex.

Best regards,

Neil Edde

Vice President and Publisher Sybex, an Imprint of Wiley


I'd like to thank all the good people at Sybex who contributed to this book, in particular Tom Cirtin, whose enthusiasm made this book possible in the first place and whose thoughtful guidance was valuable during the writing process. I am also indebted to editor David Clark, whose close read and helpful suggestions contributed to this book's readability and cohesion. Technical editor Russ Mullen checked the book for accuracy and ensured, in particular, that all the code examples work without any errors. My gratitude also goes to copy editor Liz Welch who, via a very close, line-by-line read, made sure that formatting was according to the style rules and consistency overall was for the most part achieved. Finally, thanks to Rachel Gunn, production editor, the book went smoothly through its final stages — author review and production.

About the Author

Richard Mansfield has written hundreds of magazine articles and two columns. He began writing books full-time in 1991. Mastering VBAfor Microsoft Office 2007 is his forty-second book. His recent titles include CSS Web Design for Dummies (Wiley), Office 2003 Application Development All-in-One Desk Reference For Dummies (Wiley), Visual Basic .NET Power Tools (Sybex, with Evange-los Petroutsos), The Savvy Guide to Digital Music (SAMS), and How to Do Everything with Second Life (McGraw-Hill). Overall, his books have sold more than 500,000 copies worldwide and have been translated into 12 languages.

Contents at a Glance

Introduction xxxm

Part 1 • Recording Macros and Getting Started with VBA 1

Chapter 1 • Recording and Running Macros in the Microsoft Office Applications ... 3

Chapter 2 • Getting Started with the Visual Basic Editor 29

Chapter 3 • Editing Recorded Macros 61

Chapter 4 • Creating Code from Scratch in the Visual Basic Editor 81

Part 2 • Learning How to Work With VBA 99

Chapter 5 • Understanding the Essentials of VBA Syntax 101

Chapter 6 • Working with Variables, Constants, and Enumerations 115

Chapter 7 • Using Array Variables 135

Chapter 8 • Finding the Objects, Methods, and Properties You Need 155

Part 3 • Making Decisions and Using Loops and Functions 177

Chapter 9 • Using Functions 179

Chapter 10 • Creating Your Own Functions 211

Chapter 11 • Making Decisions in Your Code 227

Chapter 12 • Using Loops to Repeat Actions 247

Part 4 • Using Message Boxes, Input Boxes, and Dialog Boxes 273

Chapter 13 • Getting User Input with Message Boxes and Input Boxes 275

Chapter 14 • Creating Simple Custom Dialog Boxes 295

Chapter 15 • Creating Complex Dialog Boxes 359

0 0

Post a comment