Cover image for Visual Basic for applications for Office 2000 unleashed
Title:
Visual Basic for applications for Office 2000 unleashed
Author:
McFedries, Paul.
Personal Author:
Publication Information:
[Indianapolis, Ind.] : SAMS Pub., 1999.
Physical Description:
xxiii, 1114 pages ; 24 cm + 1 computer laser optical disc (4 3/4 in.)
Language:
English
ISBN:
9780672315671
Format :
Book

Available:*

Library
Call Number
Material Type
Home Location
Status
Central Library QA76.73.B3 M3948 1999 Book and Software Set Central Closed Stacks
Searching...

On Order

Summary

Summary

With the release of Office 2000, Microsoft has finally achieved its goal. Now all Office products--Word, Excel, Access, and PowerPoint, have a VBA development environment at their core. VBA plays a huge role in Microsoft's future plans. Anyone interested in truly unleashing the power of the Office applications will need to learn the VBA language. With Visual Basic Applications for Office 2000 Unleashed, you'll be able to create useful procedures that enable your applications to perform like they never have before. Topics covered include OLE and ActiveX Objects; Building VBA Expressions; Working with Objects; Class Modules; VBA and Database Programming; Creating Custom Menus and Toolbars; Debugging VBA Procedures; and Programming the Windows API.


Author Notes

Paul McFedries is a computer consultant, programmer, and freelance writer. He has worked with computers since 1975 and has a degree in mathematics. He is the author or co-author of more than two dozen computer books that have sold more than one million copies worldwide.


Table of Contents

Introductionp. 1
What's New in VBA 6.0p. 1
What You Should Know Before Reading This Bookp. 3
How This Book Is Organizedp. 3
About the CDp. 5
This Book's Special Featuresp. 5
Part I Unleashing the VBA Programming Languagep. 7
1 Introducing VBAp. 9
What Is a Macro?p. 10
Recording a VBA Macrop. 12
Touring the Visual Basic Editorp. 15
Running a VBA Macrop. 20
Creating User-Defined Functions with VBAp. 21
Working with Proceduresp. 24
Working with Modulesp. 39
Setting Visual Basic Editor Optionsp. 41
Protecting Your Codep. 46
Summaryp. 47
2 Understanding Variablesp. 49
Declaring Variablesp. 50
Understanding Variable Scopep. 52
Passing Variables as Argumentsp. 57
Working with Static Variablesp. 60
Avoiding Variable Errorsp. 61
Variable Data Typesp. 62
Using Array Variablesp. 67
Working with Constantsp. 70
Summaryp. 72
3 Building VBA Expressionsp. 73
Understanding Expression Structurep. 74
VBA Operatorsp. 75
Understanding Operator Precedencep. 80
Working with Numeric Expressionsp. 84
Working with String Expressionsp. 93
Working with Logical Expressionsp. 97
Working with Date Expressionsp. 99
Formatting Numeric and Date Expressionsp. 102
New VBA 6.0 Functionsp. 109
Summaryp. 115
4 Working with Objectsp. 117
What Is an Object?p. 118
The Object Hierarchyp. 119
Working with Object Propertiesp. 120
Working with Object Methodsp. 122
Handling Object Eventsp. 124
Working with Object Collectionsp. 125
The Object Browserp. 125
Referencing Additional Object Librariesp. 128
Assigning an Object to a Variablep. 129
The Is Operatorp. 130
Working with Multiple Properties or Methodsp. 130
The Application Objectp. 132
The Window Objectp. 136
Summaryp. 138
5 Controlling Your VBA Codep. 141
Code That Makes Decisionsp. 142
Using If...Then to Make True/False Decisionsp. 142
Using If...Then...Else to Handle a False Resultp. 144
Making Multiple Decisionsp. 146
Functions That Make Decisionsp. 153
Code That Loopsp. 157
Using Do...Loop Structuresp. 158
Using For...Next Loopsp. 160
Using For Each...Next Loopsp. 162
Using Exit For or Exit Do to Exit a Loopp. 163
Summaryp. 165
Part II Unleashing Microsoft Office Objectsp. 167
6 Word 2000 VBA Programmingp. 169
The Transition from WordBasic to VBAp. 170
Reading and Setting Word's Program Options via VBAp. 172
Word's Application Objectp. 179
Working with Document Objectsp. 184
Objects That Represent Text in Wordp. 200
Checking Spelling and Grammar with VBAp. 216
New Objects in Word 2000p. 219
Summaryp. 220
7 Manipulating Excel 2000 with VBAp. 221
Excel's Macro Optionsp. 222
Using VBA to Read and Set Excel's Program Optionsp. 224
Excel's Application Objectp. 234
Manipulating Workbook Objectsp. 243
Dealing with Worksheet Objectsp. 251
Working with Range Objectsp. 259
Working with Add-In Applicationsp. 270
New Objects in Excel 2000p. 273
Summaryp. 274
8 Programming PowerPoint 2000 Presentationsp. 275
PowerPoint's Application Objectp. 276
PowerPoint's Presentation Objectp. 277
Working with PowerPoint Slide Objectsp. 283
Dealing with Shape Objectsp. 289
Operating a Slide Showp. 304
New Objects in PowerPoint 2000p. 307
Summaryp. 308
9 VBA and Access 2000p. 311
The Access Object Hierarchyp. 313
Controlling Access Optionsp. 314
More About the Access Application Objectp. 318
The Access Form Objectp. 321
The Access Report Objectp. 326
The Control Objectp. 332
Using the Handy SysCmd Functionp. 333
Creating Access Event Handlersp. 335
Working with Access Modulesp. 337
Protecting Access Projectsp. 338
New Objects in Access 2000p. 339
Summaryp. 340
Part III Unleashing VBA User Interface Designp. 341
10 Interacting with the Userp. 343
Programming Soundsp. 344
Displaying Information to the Userp. 346
Getting Input from the Userp. 357
Summaryp. 363
11 Working with Microsoft Formsp. 365
Understanding Custom Forms and Dialog Boxesp. 366
Adding a Form to Your Projectp. 367
Sharing Forms Between VBA Applicationsp. 368
Changing the Form's Design-Time Propertiesp. 369
Working with Controlsp. 373
Handling Form Eventsp. 388
Types of Form Controlsp. 389
Using a Form in a Procedurep. 400
Summaryp. 405
12 Creating Custom Menus and Toolbarsp. 407
Assigning Macros to Menu Commandsp. 408
Creating Custom Toolbars for Your Macrosp. 413
Menus, Toolbars, and VBAp. 415
Understanding Command Barsp. 416
Working with Command Barsp. 419
Working with Command Bar Controlsp. 425
Summaryp. 435
Part IV Unleashing Application Integrationp. 437
13 Working with Other Applicationsp. 439
Starting Another Applicationp. 440
Activating a Running Applicationp. 444
Sending Keystrokes to an Applicationp. 447
Using Dynamic Data Exchangep. 451
Summaryp. 461
14 Programming OLE and ActiveX Objectsp. 463
First, Some OLE Fundamentalsp. 464
Programming Linked and Embedded Objectsp. 472
Inserting OLE Objectsp. 472
Working with Linked and Embedded Objectsp. 482
Summaryp. 488
15 Controlling Applications via Automationp. 489
Understanding Automationp. 490
Accessing Automation Objectsp. 494
Handling Automation Errorsp. 500
Summaryp. 502
16 Rolling Your Own Objects with Class Modulesp. 503
Partway There: Custom Collectionsp. 504
Understanding Class Modulesp. 509
Setting Up a Class Modulep. 511
Implementing Class Propertiesp. 513
Setting Up the Class Methodsp. 516
Defining the Class Eventsp. 517
Creating Class Collectionsp. 518
Implementing Class Properties for Objectsp. 520
Using Events with the Office Application Objectsp. 522
Summaryp. 525
Part V Unleashing VBA Database Programmingp. 527
17 Using VBA to Work with Excel Listsp. 529
What Is a List?p. 530
Working with List Datap. 531
Setting Up the Applicationp. 533
Entering Datap. 537
Editing Datap. 544
Filtering Datap. 547
Getting a Count of the Database Recordsp. 550
Deleting Recordsp. 551
Sorting Datap. 553
Subtotaling Datap. 554
Summaryp. 555
18 Programming Data Access Objectsp. 557
About Data Access Objectsp. 558
Accessing Data in an External Databasep. 560
Working with Recordsetsp. 569
Querying a Recordsetp. 576
Retrieving Data into Excelp. 579
Summaryp. 584
19 Advanced Database Programmingp. 585
Maintaining a Jet Databasep. 586
Working with Transaction Processingp. 597
Using the ODBCDirect Workspacep. 600
Programming Jet Database Securityp. 609
A Peek at the Future: ActiveX Data Objects (ADO)p. 623
Summaryp. 638
Part VI Unleashing VBA Internet and Intranet Programmingp. 639
20 Internet and Intranet Programming Topicsp. 641
Using VBA to Read and Set the Office 2000 Web Optionsp. 643
Programming Word's Email Optionsp. 648
Publishing to HTMLp. 651
Controlling Office 2000 Hyperlinksp. 658
Building a Custom Web Browserp. 664
Controlling Internet Explorer Via Automationp. 674
Summaryp. 677
21 HTML Programming: VBScript and the Script Editorp. 679
The Differences Between VBA and VBScriptp. 680
Attaching Scripts to a Pagep. 683
The Scripting Object Hierarchyp. 686
How VBScript Interacts with Formsp. 695
Example: A Mortgage Calculatorp. 699
Working with the Script Editorp. 705
Summaryp. 708
22 Email Programming with Outlookp. 709
Understanding the NameSpace Objectp. 710
Using the Explorer Objectp. 710
The Inspector Objectp. 713
Working with MAPIFolder Objectsp. 714
Understanding Itemsp. 719
A Closer Look at MailItem Objectsp. 720
Handling Object Events in Outlook VBAp. 729
Automation and the Outlook Object Modelp. 734
Summaryp. 737
Part VII Unleashing Advanced VBA Programmingp. 739
23 Trapping Program Errorsp. 741
A Basic Error-Trapping Strategyp. 743
Working with the Err Objectp. 750
Trappable VBA Errorsp. 753
Summaryp. 757
24 Debugging VBA Proceduresp. 759
A Basic Strategy for Debuggingp. 760
Pausing a Procedurep. 762
Stepping Through a Procedurep. 766
Monitoring Procedure Valuesp. 768
Using the Immediate Windowp. 773
Debugging Tipsp. 776
Summaryp. 779
25 Programming the Windows APIp. 781
Understanding the Win32 APIp. 782
Declaring Win32 API Proceduresp. 783
Win32 API Examplesp. 789
The Registry and the Win32 APIp. 806
Summaryp. 815
26 VBA Tips and Techniquesp. 817
Conditional Compilation in VBAp. 818
Saving Application Settings in the Registryp. 823
Accessing the File System Through VBAp. 829
Low-Level File I/Op. 839
Tips for Faster Proceduresp. 856
Digitally Signing a VBA Projectp. 859
Summaryp. 860
Part VIII Unleashing VBA Applicationsp. 861
27 An Excel Checkbook Applicationp. 863
Using Checkbookp. 864
Balancing the Checkbookp. 869
How the Checkbook Application Worksp. 871
Summaryp. 895
28 Making Backups as You Workp. 897
Using the Backup Applicationp. 898
Understanding the Backup Applicationp. 901
Backup and the Registryp. 901
A Tour of the Backup Formp. 903
Backup's Support Proceduresp. 920
Summaryp. 934
29 Access and Outlook: Email Mergep. 935
What Email Merge Doesp. 936
Creating a Mailingp. 937
A Tour of the Email Merge Databasep. 943
Under the Hood: The Codep. 948
Summaryp. 969
Appendixesp. 971
A VBA Statementsp. 973
B VBA Functionsp. 981
C Programming the Windows Scripting Hostp. 991
Understanding the Windows Scripting Hostp. 992
Creating Scriptsp. 996
The Windows Scripting Host Object Modelp. 997
The WScript Objectp. 997
The WshShell Objectp. 1010
The WshNetwork Objectp. 1018
D The Windows ANSI Character Setp. 1023
E HTML Primerp. 1027
Understanding HTML Tagsp. 1028
The Basic Structure of Web Pagesp. 1029
Adding a Titlep. 1029
Text and Paragraphsp. 1030
Adding Formatting and Headingsp. 1030
Setting Up Listsp. 1032
Working with Hyperlinksp. 1034
Inserting Imagesp. 1035
Setting Up Tablesp. 1036
Working with HTML Formsp. 1038
Indexp. 1053

Google Preview