Integrating Excel and Access - GBV

5 downloads 1813 Views 70KB Size Report
Integrating Excel and Access. Michael Schmalz. O'REILLY*. Beijing • Cambridge • Farnham • Koln • Paris • Sebastopol • Taipei • Tokyo ...
Integrating Excel and Access

Michael Schmalz

O'REILLY* Beijing • Cambridge • Farnham • Koln • Paris • Sebastopol • Taipei • Tokyo

Table of Contents

Preface

ix

1.

Introduction to Access/Excel Integration Communications Between Excel and Access Automation Objects ADO and DAO Tackling Projects Designing Applications

1 2 2 3 4 6

2.

Using the Excel User Interface Using External Data Using Database Queries Returning a PivotTable to Excel Using Microsoft Query to Gather Data Keeping the Query Updated with VBA

'•

3. Data Access from Excel VBA Writing a Reusable Module for Data Access Choosing Between ADO and DAO CopyFromRecordset Versus Looping Formatting Techniques Formatting Techniques Example 4. Integration from the Access Interface Importing Excel Data Linking Excel Data Using Export and Analyzing It with Microsoft Office Excel

8 8 12 15 16 18 21 22 24 28 30 ' 34 41 42 50 52

Using Raw Exported Access Data in Excel Exporting an Access Report to Excel

55 56

5. Using Access VBA to Automate Excel High-Level Excel Objects Other Excel Objects Writing and Using Queries in VBA Referencing Sheets, Ranges, and Cells Writing Excel Worksheet Functions from Access VBA

57 57 63 66 82 84

6. Using Excel Charts and Pivot Tables with Access Data Automating Pivot Tables Building a Regular Chart Using an Array Formula Graphing Variables in a Model

86 87 94 98 102

7. Leveraging SQL Server Data with Microsoft Office Pass-Through Queries Versus Linked Tables Creating a Connection Using VBA Building the Connection in Access Pulling Data in with Excel Alone Using DTS to Automate Excel Crosstab Queries on SQL Server

104 104 107 108 112 116 120

8. Advanced Excel Reporting Techniques Writing Flexible Formulas Changing Data in an Existing Report Creating a Report from Scratch Using an Access Table for Reporting

125 125 128 132 137

9. Using Access and Excel Data in Other Applications Automating Microsoft Word Getting Information from Microsoft Word Automating PowerPoint Using Data in MapPoint 10. Creating Form Functionality in Excel Working with the UserForm Accepting Parameters Other Useful Items

Table of Contents

146 146 152 ' 155 158 166 167 172 175

11. Building Graphical User Interfaces Setting Up a Form Using Events Using Data > Adding Buttons Tab Order

-

177 178 178 181 183 184

12. Tackling an Integration Project

186

The Project Description Main Menu Customer Information Billing and Payment Information Contact History Services and Charges Expense Entry Invoices Letters Income Statements

186 187 188 190 190 190 190 191 191 192

A. Excel Object Model

195

B. VBABasics

206

Index

.'

211

Table of Contents I vii