Product Cover Image

Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel, VBA, and .NET, Safari, 2nd Edition

By Rob Bovey, Dennis Wallentin, Stephen Bullen, John Green

Published by Addison-Wesley Professional

Published Date: May 1, 2009

More Product Info

Description

“As Excel applications become more complex and the Windows development platform more powerful, Excel developers need books like this to help them evolve their solutions to the next level of sophistication. Professional Excel Development is a book for developers who want to build powerful, state-of-the-art Excel applications using the latest Microsoft technologies.”

–Gabhan Berry, Program Manager, Excel Programmability, Microsoft

 

“The first edition of Professional Excel Development is my most-consulted and most-recommended book on Office development. The second edition expands both the depth and range. It shines because it takes every issue one step further than you expect. The book relies on the authors’ current, real-world experience to cover not only how a feature works, but also the practical implications of using it in professional work.”

–Shauna Kelly, Director, Thendara Green

 

“This book illustrates techniques that will result in well-designed, robust, and maintainable Excel-based applications. The authors’ advice comes from decades of solid experience of designing and building applications. The practicality of the methods is well illustrated by the example timesheet application that is developed step-by-step through the book. Every serious Excel developer should read this and learn from it. I did.”

Bill Manville, Application Developer, Bill Manville Associates

 

The Start-to-Finish Guide to Building State-of-the-Art Solutions with Excel 2007

 

In this book, four world-class Microsoft® Excel developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors—three of whom have been honored by Microsoft as Excel Most Valuable Professionals (MVPs)—show how to consistently make the right design decisions and make the most of Excel’s most powerful new features. Using their techniques,you can reduce development costs, time to market, and hassle—and build more effective, successful solutions.

 

Fully updated for Excel 2007, this book starts where other books on Excel programming leave off. Through a hands-on case study project, you’ll discover best practices for planning, architecting, and building Excel applications that are robust, secure, easy to maintain, and highly usable. If you’re a working developer, no other book on Excel programming offers you this much depth, insight, or value.

 

•    Design worksheets that will be more useful and reliable

•    Leverage built-in and application-specific add-ins

•    Construct applications that behave like independent Windows programs

•    Make the most of the new Ribbon user interface

•    Create cross-version applications that work with legacy versions of Excel

•    Utilize XML within Excel applications

•    Understand and use Windows API calls

•    Master VBA error handling, debugging, and performance optimization

•    Develop applications based on data stored in Access, SQL Server, and other databases

•    Build powerful visualization solutions with Excel charting engine

•    Learn how to work with VB.NET and leverage its IDE

•    Automate Microsoft Excel with VB.NET

•    Create managed COM add-ins for Microsoft Excel with VB.NET

•    Develop Excel solutions with Visual Studio Tools for Office (VSTO)

•    Integrate Excel with Web Services

•    Deploy applications more securely and efficiently

Table of Contents

Acknowledgments . . . xiv

About the Authors . . . xv

Chapter 1 Introduction

About This Book . . . 1

Who Should Read This Book . . . 2

Excel Developer Categories . . . 2

Excel as an Application Development Platform . . . 4

Structure . . . 7

Examples . . . 8

Supported Versions of Excel . . . 9

Typefaces . . . 10

On the CD . . . 10

Help and Support . . . 11

The Professional Excel Development Web Site . . . 12

Feedback . . . 12

Chapter 2 Application Architectures

Concepts . . . 13

Chapter 3 Excel and VBA Development Best Practices

Naming Conventions . . . 27

Best Practices for Application Structure and Organization . . . 40

General Application Development Best Practices . . . 45

Chapter 4 Worksheet Design

Principles of Good Worksheet UI Design . . . 69

Program Rows and Columns: The Fundamental UI Design Technique . . . 70

Defined Names . . . 71

Styles . . . 78

User Interface Drawing Techniques . . . 83

Data Validation . . . 88

Conditional Formatting . . . 92

Using Controls on Worksheets . . . 98

Practical Example . . . 100

Chapter 5 Function, General, and Application-Specific Add-ins

The Four Stages of an Application . . . 107

Function Library Add-ins . . . 110

General Add-ins . . . 117

Application-Specific Add-ins . . . 118

Practical Example . . . 125

Chapter 6 Dictator Applications

Structure of a Dictator Application . . . 141

Practical Example . . . 157

Chapter 7 Using Class Modules to Create Objects

Creating Objects . . . 166

Creating a Collection . . . 170

Trapping Events . . . 177

Raising Events . . . 180

Practical Example . . . 188

Chapter 8 Advanced Command Bar Handling

Command Bar Design . . . 198

Table-Driven Command Bars . . . 199

Putting It All Together . . . 219

Loading Custom Icons from Files . . . 228

Hooking Command Bar Control Events . . . 232

Practical Example . . . 241

Chapter 9 Introduction to XML

XML . . . 249

Chapter 10 The Office 2007 Ribbon User Interface

The RibbonX Paradigm . . . 273

An Introduction to the Office 2007 Open XML File Format . . . 274

Ribbon Design and Coding Best Practices . . . 278

Table-Driven Ribbon UI Customization . . . 289

Advanced Problem Solving . . . 291

Further Reading . . . 300

Related Portals . . . 300

Chapter 11 Creating Cross-Version Applications

Command Bar and Ribbon User Interfaces in a Single Application . . . 304

Other Excel 2007 Development Issues . . . 319

Windows Vista Security and Folder Structure . . . 326

Chapter 12 Understanding and Using Windows API Calls Overview . . . 331

Working with the Screen . . . 337

Working with Windows . . . 340

Working with the Keyboard . . . 349

Working with the File System and Network . . . 355

Practical Examples . . . 369

Chapter 13 UserForm Design and Best Practices

Principles . . . 375

Control Fundamentals . . . 384

Visual Effects . . . 392

UserForm Positioning and Sizing . . . 400

Wizards . . . 407

Dynamic UserForms . . . 411

Modeless UserForms . . . 419

Control Specifics . . . 425

Practical Example . . . 432

Chapter 14 Interfaces

What Is an Interface? . . . 433

Code Reuse . . . 435

Defining a Custom Interface . . . 437

Implementing a Custom Interface . . . 438

Using a Custom Interface . . . 440

Polymorphic Classes . . . 443

Improving Robustness . . . 448

Simplifying Development . . . 448

A Plug-in Architecture . . . 460

Practical Example . . . 462

Chapter 15 VBA Error Handling

Error Handling Concepts . . . 465

The Single Exit Point Principle . . . 475

Simple Error Handling . . . 475

Complex Project Error Handler Organization . . . 476

The Central Error Handler . . . 481

Error Handling in Classes and UserForms . . . 488

Putting It All Together . . . 490

Practical Example . . . 496

Chapter 16 VBA Debugging

Basic VBA Debugging Techniques . . . 507

The Immediate Window (Ctrl+G) . . . 517

The Call Stack (Ctrl+L) . . . 521

The Watch Window . . . 522

The Locals Window . . . 532

The Object Browser (F2) . . . 533

Creating and Running a Test Harness . . . 537

Using Assertions . . . 540

Debugging Shortcut Keys That Every Developer Should Know . . . 542

Chapter 17 Optimizing VBA Performance

Measuring Performance . . . 545

The PerfMon Utility . . . 546

Creative Thinking . . . 551

Macro-Optimization . . . 556

Micro-Optimization . . . 567

Chapter 18 Introduction to Database Development

An Introduction to Databases . . . 577

An Introduction to SQL . . . 594

Data Access with ADO . . . 598

Further Reading . . . 613

Chapter 19 Programming with Access and SQL Server

A Note on the Northwind Sample Database . . . 615

Designing the Data Access Tier . . . 616

Working with Microsoft Access Databases . . . 620

Working with Microsoft SQL Server Databases . . . 630

Upsizing from Access to SQL Server . . . 642

Further Reading . . . 647

Practical Example . . . 648

Chapter 20 Data Manipulation Techniques

Excel’s Data Structures . . . 661

Data Processing Features . . . 667

Advanced Functions . . . 678

Chapter 21 Advanced Charting Techniques

Fundamental Techniques . . . 687

VBA Techniques . . . 702

Chapter 22 Controlling Other Office Applications

Fundamentals . . . 709

The Primary Office Application Object Models . . . 725

Further Reading . . . 739

Practical Example . . . 740

Chapter 23 Excel and Visual Basic 6

A Hello World ActiveX DLL . . . 742

Why Use VB6 ActiveX DLLs in Excel VBA Projects . . . 758

In-Process Versus Out-of-Process . . . 774

Automating Excel from a VB6 EXE . . . 775

COM Add-ins . . . 783

A “Hello World” COM Add-in . . . 783

The Add-in Designer . . . 788

Installation Considerations . . . 790

The AddinInstance Events . . . 792

Command Bar Handling . . . 795

Why Use a COM Add-in? . . . 798

Automation Add-ins . . . 799

Practical Examples . . . 802

Chapter 24 Excel and VB.NET

.NET Framework Fundamentals . . . 818

Visual Basic.NET . . . 819

Debugging . . . 845

Useful Development Tools . . . 853

Automating Excel . . . 855

Resources in .NET Solutions . . . 863

Retrieving Data with ADO.NET . . . 864

Further Reading . . . 870

Additional Development Tools . . . 871

Q&A Forums . . . 871

Practical Example–PETRAS Report Tool .NET . . . 872

Chapter 25 Writing Managed COM Add-ins with VB.NET

Choosing a Development Toolset . . . 890

Creating a Managed COM Add-in . . . 891

Building the User Interface . . . 908

Creating Managed Automation Add-ins . . . 928

Manually Register and Unregister COM Add-ins . . . 940

Using Classes in VB.NET . . . 940

Using Classic ADO to Export Data to Excel . . . 948

Shimming COM Add-ins . . . 952

Related Blogs . . . 962

Additional Development Tools . . . 962

Practical Example–PETRAS Report Tool.NET . . . 963

Chapter 26 Developing Excel Solutions with Visual Studio Tools for Office System (VSTO)

What Is VSTO? . . . 976

When Should You Use VSTO? . . . 983

Working with VSTO Add-Ins . . . 985

Working with VSTO Templates and Workbook Solutions . . . 1006

Deployment and Security . . . 1016

Further Reading . . . 1026

Related Portal and Blogs . . . 1026

Additional Development Tools . . . 1026

Chapter 27 XLLs and the C API

Why Create an XLL-Based Worksheet Function . . . 1029

Creating an XLL Project in Visual Studio . . . 1030

The Structure of an XLL . . . 1034

The XLOPER and OPER Data Types . . . 1044

The Excel4 Function . . . 1050

Commonly Used C API Functions . . . 1052

XLOPERs and Memory Management . . . 1053

Registering and Unregistering Custom Worksheet Functions . . . 1054

Sample Application Function . . . 1057

Debugging the Worksheet Functions . . .1060

Miscellaneous Topics . . .1061

Additional Resources . . . 1062

Chapter 28 Excel and Web Services

Web Services . . . 1065

Practical Example . . . 1072

Chapter 29 Providing Help, Securing, Packaging, and Distributing

Providing Help . . . 1085

Securing . . . 1094

Packaging . ..1099

Distributing . . . 1104

Index . . . 1107

Purchase Info

ISBN-10: 0-321-57912-7

ISBN-13: 978-0-321-57912-6

Format: Safari PTG

This publication is not currently for sale.