Synopses & Reviews
Newly updated for Excel 2002, Writing Excel Macros with VBA, 2nd Edition provides Excel power-users, as well as programmers who are unfamiliar with the Excel object model, with a solid introduction to writing Visual Basic for Applications (VBA) macros and programs for Excel. In particular, the book focuses on:
- The Visual Basic Editor and the Excel VBA programming environment. Excel features a complete, state-of-the-art integrated development environment for writing, running, testing, and debugging VBA macros.
The VBA programming language, the same programming language used by the other applications in Microsoft Office XP and 2000, as well as by the retail editions of Visual Basic 6.0. The Excel object model, including new objects and new members of existing objects in Excel 2002. Excel exposes nearly all of its functionality through its object model, which is the means by which Excel can be controlled programmatically using VBA. While the Excel object model, with 192 objects, is the second largest among the Office applications, you need to be familiar with only a handful of objects to write effective macros. Writing Excel Macros
focuses on these essential objects, but includes a discussion of many more objects as well.Writing Excel Macros with VBA, 2nd Edition
is written in a terse, no-nonsense manner that is characteristic of Steven Roman's straightforward, practical approach. Instead of a slow-paced tutorial with a lot of handholding, Roman offers the essential information about Excel VBA that you must master to write macros effectively. This tutorial is reinforced by interesting and useful examples that solve common problems you're sure to have encountered.Writing Excel Macros with VBA, 2nd Edition
is the book you need to delve into the basics of Excel VBA programming, enabling you to increase your power and productivity.
Writing Excel Macros with VBA, 2"nd" Edition offers a solid introduction to writing VBA macros and programs in Excel and shows readers how to get more power out of Excel at the programming level: focusing on programming languages, the Visual Basic Editor, handling code, and the Excel object model.
Updated for Excel 2002, this text offers Excel power-users, as well as programmers who are unfamiliar with the Excel object model, with an introduction to writing Visual Basic for Applications (VBA) macros and programs for Excel.
Offering a solid introduction to writing VBA macros and programs in Excel, this guide shows readers how to get more power out of Excel at the programming level.
About the Author
Dr. Roman has authored 32 books, including a number of books on mathematics, such as Coding and Information Theory, Advanced Linear Algebra, and Field Theory, published by Springer-Verlag. He has also written Modules in Mathematics, a series of 15 small books designed for the general college-level liberal arts student. Besides his books for O'Reilly, Dr. Roman has written two other computer books, both published by Springer-Verlag.
Table of Contents
Preface; Preface to the Second Edition; The Book's Audience; Organization of This Book; The Book's Text and Sample Code; About the Code; Conventions in this Book; Obtaining the Sample Programs; How to Contact Us; Acknowledgments; Chapter 1: Introduction; 1.1 Selecting Special Cells; 1.2 Setting a Chart's Data Point Labels; 1.3 Topics in Learning Excel Programming; Part I: The VBA Environment; Chapter 2: Preliminaries; 2.1 What Is a Programming Language?; 2.2 Programming Style; Chapter 3: The Visual Basic Editor, Part I; 3.1 The Project Window; 3.2 The Properties Window; 3.3 The Code Window; 3.4 The Immediate Window; 3.5 Arranging Windows; Chapter 4: The Visual Basic Editor, Part II; 4.1 Navigating the IDE; 4.2 Getting Help; 4.3 Creating a Procedure; 4.4 Run Time, Design Time, and Break Mode; 4.5 Errors; 4.6 Debugging; 4.7 Macros; Part II: The VBA Programming Language; Chapter 5: Variables, Data Types, and Constants; 5.1 Comments; 5.2 Line Continuation; 5.3 Constants; 5.4 Variables and Data Types; 5.5 VBA Operators; Chapter 6: Functions and Subroutines; 6.1 Calling Functions; 6.2 Calling Subroutines; 6.3 Parameters and Arguments; 6.4 Exiting a Procedure; 6.5 Public and Private Procedures; 6.6 Project References; Chapter 7: Built-in Functions and Statements; 7.1 The MsgBox Function; 7.2 The InputBox Function; 7.3 VBA String Functions; 7.4 Miscellaneous Functions and Statements; 7.5 Handling Errors in Code; Chapter 8: Control Statements; 8.1 The If...Then Statement; 8.2 The For Loop; 8.3 The For Each Loop; 8.4 The Do Loop; 8.5 The Select Case Statement; 8.6 A Final Note on VBA; Part III: Excel Applications and the Excel Object Model; Chapter 9: Object Models; 9.1 Objects, Properties, and Methods; 9.2 Collection Objects; 9.3 Object Model Hierarchies; 9.4 Object Model Syntax; 9.5 Object Variables; Chapter 10: Excel Applications; 10.1 Providing Access to an Application's Features; 10.2 Where to Store an Application; 10.3 An Example Add-In; Chapter 11: Excel Events; 11.1 The EnableEvents Property; 11.2 Events and the Excel Object Model; 11.3 Accessing an Event Procedure; 11.4 Worksheet Events; 11.5 WorkBook Events; 11.6 Chart Events; 11.7 Application Events; 11.8 QueryTable Refresh Events; Chapter 12: Custom Menus and Toolbars; 12.1 Menus and Toolbars: An Overview; 12.2 The CommandBars Collection; 12.3 Creating a New Menu Bar or Toolbar; 12.4 Command-Bar Controls; 12.5 Built-in Command-Bar-Control IDs; 12.6 Example: Creating a Menu; 12.7 Example: Creating a Toolbar; 12.8 Example: Adding an Item to an Existing Menu; 12.9 Augmenting the SRXUtils Application; Chapter 13: Built-In Dialog Boxes; 13.1 The Show Method; Chapter 14: Custom Dialog Boxes; 14.1 What Is a UserForm Object?; 14.2 Creating a UserForm Object; 14.3 ActiveX Controls; 14.4 Adding UserForm Code; 14.5 Excel's Standard Controls; 14.6 Example: The ActivateSheet Utility; 14.7 ActiveX Controls on Worksheets; Chapter 15: The Excel Object Model; 15.1 A Perspective on the Excel Object Model; 15.2 Excel Enums; 15.3 The VBA Object Browser; Chapter 16: The Application Object; 16.1 Properties and Methods of the Application Object; 16.2 Children of the Application Object; Chapter 17: The Workbook Object; 17.1 The Workbooks Collection; 17.2 The Workbook Object; 17.3 Children of the Workbook Object; 17.4 Example: Sorting Sheets in a Workbook; Chapter 18: The Worksheet Object; 18.1 Properties and Methods of the Worksheet Object; 18.2 Children of the Worksheet Object; 18.3 Protection in Excel XP; 18.4 Example: Printing Sheets; Chapter 19: The Range Object; 19.1 The Range Object as a Collection; 19.2 Defining a Range Object; 19.3 Additional Members of the Range Object; 19.4 Children of the Range Object; 19.5 Example: Getting the Used Range; 19.6 Example: Selecting Special Cells; Chapter 20: Pivot Tables; 20.1 Pivot Tables; 20.2 The PivotTable Wizard; 20.3 The PivotTableWizard Method; 20.4 The PivotTable Object; 20.5 Properties and Methods of the PivotTable Object; 20.6 Children of the PivotTable Object; 20.7 The PivotField Object; 20.8 The PivotCache Object; 20.9 The PivotItem Object; 20.10 PivotCell and PivotItemList Objects; 20.11 Calculated Items and Calculated Fields; 20.12 Example: Printing Pivot Tables; Chapter 21: The Chart Object; 21.1 Chart Objects and ChartObject Objects; 21.2 Creating a Chart; 21.3 Chart Types; 21.4 Children of the Chart Object; 21.5 The Axes Collection; 21.6 The Axis Object; 21.7 The ChartArea Object; 21.8 The ChartGroup Object; 21.9 The ChartTitle Object; 21.10 The DataTable Object; 21.11 The Floor Object; 21.12 The Legend Object; 21.13 The PageSetup Object; 21.14 The PlotArea Object; 21.15 The Series Object; 21.16 Properties and Methods of the Chart Object; 21.17 Example: Scrolling Through Chart Types; 21.18 Example: Printing Embedded Charts; 21.19 Example: Setting Data Series Labels; Chapter 22: Smart Tags; 22.1 What Are Smart Tags?; 22.2 SmartTagRecognizer Object; 22.3 SmartTag Object; 22.4 SmartTagAction Object; 22.5 SmartTagOptions Object; Part IV: Appendixes; Appendix A: The Shape Object; A.1 What Is the Shape Object?; A.2 Z-Order; A.3 Creating Shapes; A.4 Diagram, DiagramNode, and DiagramNodeChildren Objects; Appendix B: Getting the Installed Printers; Appendix C: Command Bar Controls; C.1 Built-in Command-Bar Controls; Appendix D: Face IDs; Appendix E: Programming Excelfrom Another Application; E.1 Setting a Reference to the Excel Object Model; E.2 Getting a Reference to the Excel Application Object; Appendix F: High-Level and Low-Level Languages; F.1 BASIC; F.2 Visual Basic; F.3 C and C++; F.4 Visual C++; F.5 Pascal; F.6 FORTRAN; F.7 COBOL; F.8 LISP; Appendix G: New Objects in Excel XP; Colophon;