Hilfe Warenkorb Konto Anmelden
 
 
   Schnellsuche   
     zur Expertensuche                      
Mastering VBA for Microsoft Office 2016  
Mastering VBA for Microsoft Office 2016
von: Richard Mansfield
Sybex, 2016
ISBN: 9781119225393
987 Seiten, Download: 22068 KB
 
Format:  PDF
geeignet für: Apple iPad, Android Tablet PC's Online-Lesen PC, MAC, Laptop

Typ: A (einfacher Zugriff)

 

 
eBook anfordern
Inhaltsverzeichnis

  Cover 1  
  Title Page 5  
  Copyright 6  
  Contents 15  
  Introduction 33  
  Part 1 Recording Macros and Getting Started with VBA 41  
     Chapter 1 Recording and Running Macros in the Office Applications 43  
        What Is VBA and What Can You Do with It? 43  
           The Difference Between Visual Basic and Visual Basic for Applications 44  
        Understanding Macro Basics 45  
        Recording a Macro 46  
           Displaying the Developer Tab on the Ribbon 47  
           Planning the Macro 47  
           Starting the Macro Recorder 48  
           Naming the Macro 51  
           Choosing How to Run a New Macro 56  
        Running a Macro 63  
        Recording a Sample Word Macro 64  
        Recording a Sample Excel Macro 67  
           Creating a Personal Macro Workbook 67  
           Recording the Macro 67  
        Specifying How to Trigger an Existing Macro 69  
           Assigning a Macro to a Quick Access Toolbar Button in Word 69  
           Assigning a Macro to a Shortcut Key Combination 69  
        Deleting a Macro 69  
        The Bottom Line 71  
     Chapter 2 Getting Started with the Visual Basic Editor 73  
        Opening the Visual Basic Editor 73  
           Opening the Visual Basic Editor with a Macro Selected 74  
           Opening the Visual Basic Editor Directly 74  
           Navigating to a Macro 75  
        Using the Visual Basic Editor’s Main Windows 76  
           The Project Explorer 76  
           The Object Browser 80  
           The Code Window 80  
           The Properties Window 85  
           The Immediate Window 88  
        Setting Properties for a Project 88  
        Customizing the Visual Basic Editor 91  
           Choosing Editor and View Preferences 91  
           Choosing and Laying Out the Editor Windows 99  
           Customizing the Toolbar and Menu Bar 99  
           Customizing the Toolbox 100  
        The Bottom Line 104  
     Chapter 3 Editing Recorded Macros 107  
        Testing a Macro in the Visual Basic Editor 108  
           Stepping Through a Macro 109  
           Setting Breakpoints 111  
           Commenting Out Lines 111  
           Stepping Out of a Macro 112  
        Editing a Word Macro 113  
           Stepping Through the Transpose_Word_Right Macro 114  
           Running the Transpose_Word_Right Macro 115  
           Creating a Transpose_Word_Left Macro 115  
           Saving Your Work 116  
        Editing the Excel Macro 116  
           Unhiding the Personal Macro Workbook 117  
           Opening a Macro for Editing 117  
           Editing a Macro 118  
        Editing a PowerPoint Macro 120  
           Saving Your Work 125  
        The Bottom Line 127  
     Chapter 4 Creating Code from Scratch in the Visual Basic Editor 129  
        Setting Up the Visual Basic Editor to Create Macros 129  
        Creating a Procedure for Word 131  
        Creating a Macro for Excel 136  
        Creating a Procedure for PowerPoint 141  
        Creating a Procedure for Access 146  
        The Bottom Line 147  
  Part 2 Learning How to Work with VBA 149  
     Chapter 5 Understanding the Essentials of VBA Syntax 151  
        Getting Ready 151  
        Procedures 152  
           Functions 153  
           Subprocedures 153  
        Statements 154  
        Keywords 157  
        Expressions 158  
        Operators 158  
        Variables 158  
        Constants 160  
        Arguments 160  
           Specifying Argument Names vs. Omitting Argument Names 161  
           Including Parentheses Around the Argument List 162  
        Objects 163  
        Collections 163  
        Properties 163  
        Methods 164  
        Events 164  
        The Bottom Line 166  
     Chapter 6 Working with Variables, Constants, and Enumerations 169  
        Working with Variables 170  
           Choosing Names for Variables 170  
           Declaring a Variable 171  
           Choosing the Scope and Lifetime of a Variable 174  
           Specifying the Data Type for a Variable 181  
        Working with Constants 187  
           Declaring Your Own Constants 188  
           Choosing the Scope or Lifetime for Your Constants 188  
        Working with Enumerations 189  
        The Bottom Line 190  
     Chapter 7 Using Array Variables 191  
        What Is an Array? 191  
        Declaring an Array 193  
        Storing Values in an Array 195  
        Multidimensional Arrays 196  
        Declaring a Dynamic Array 197  
        Redimensioning an Array 197  
        Returning Information from an Array 198  
        Erasing an Array 198  
        Determining Whether a Variable Is an Array 198  
        Finding the Bounds of an Array 198  
        Sorting an Array 199  
        Searching an Array 203  
           Performing a Linear Search Through an Array 203  
           Binary Searching an Array 208  
        The Bottom Line 213  
     Chapter 8 Finding the Objects, Methods, and Properties You Need 215  
        What Is an Object? 215  
           The Benefits of OOP 215  
           Understanding Creatable Objects 217  
           Properties 217  
           Methods 218  
        Working with Collections 220  
           Working with an Object in a Collection 221  
           Adding an Object to a Collection 222  
        Finding the Objects You Need 222  
           Using the Macro Recorder to Add Code for the Objects You Need 222  
           Using the Object Browser 225  
           Using Help to Find the Object You Need 231  
           Using the Auto List Members Feature 233  
        Using Object Variables to Represent Objects 234  
        Team Programming and OOP 237  
        The Bottom Line 239  
  Part 3 Making Decisions and Using Loops and Functions 241  
     Chapter 9 Using Built-In Functions 243  
        What Is a Function? 243  
        Using Functions 245  
           Passing Arguments to a Function 247  
        Using Functions to Convert Data 248  
        Using the Asc Function to Return a Character Code 250  
        Using the Val Function to Extract a Number from the Start of a String 250  
           Using the Str Function to Convert a Number into a String 252  
        Using the Format Function to Format an Expression 253  
        Using the Chr Function and Constants to Enter Special Characters in a String 258  
        Using Functions to Manipulate Strings 259  
        Using the Left, Right, and Mid Functions to Return Part of a String 261  
        Using InStr and InStrRev to Find a String Within Another String 264  
        Using LTrim, RTrim, and Trim to Remove Spaces from a String 267  
        Using Len to Check the Length of a String 268  
        Using StrConv, LCase, and UCase to Change the Case of a String 269  
        Using the StrComp Function to Compare Apples to Apples 271  
        Using VBA’s Mathematical Functions 271  
        Using VBA’s Date and Time Functions 272  
        Using the DatePart Function to Parse Dates 274  
        Calculating Time Intervals Using the DateDiff Function 275  
        Using the DateAdd Function to Add or Subtract Time from a Date 276  
        Using File-Management Functions 276  
        Checking Whether a File Exists Using the Dir Function 276  
           Returning the Current Path 278  
        The Bottom Line 278  
     Chapter 10 Creating Your Own Functions 281  
        Components of a Function 282  
        Creating a Function 284  
           Starting a Function Manually 284  
           Starting a Function by Using the Add Procedure Dialog Box 284  
           Passing Arguments to a Function 285  
           Declaring the Data Types of Arguments 286  
           Specifying an Optional Argument 286  
           Controlling the Scope of a Function 287  
        Examples of Functions for Any VBA-Enabled Office Application 287  
           How Functions Return Information 288  
           Returning Text Data from a Function 289  
        Creating a Function for Word 291  
        Creating a Function for Excel 293  
        Creating a Function for PowerPoint 295  
        Creating a Function for Access 297  
        The Bottom Line 298  
     Chapter 11 Making Decisions in Your Code 301  
        How Do You Compare Things in VBA? 302  
        Testing Multiple Conditions by Using Logical Operators 303  
           If Blocks 306  
           If…Then 306  
           If…Then…Else Statements 308  
           If…Then…ElseIf…Else Statements 310  
           Creating Loops with If and GoTo 315  
           Nesting If Blocks 316  
        Select Case Blocks 318  
           Syntax 319  
           Example 319  
           When Order Matters 321  
        The Bottom Line 322  
     Chapter 12 Using Loops to Repeat Actions 323  
        When Should You Use a Loop? 323  
        Understanding the Basics of Loops 324  
        Using For… Loops for Fixed Repetitions 325  
           For...Next Loops 325  
           For Each…Next Loops 333  
           Using an Exit For Statement 334  
        Using Do… Loops for Variable Numbers of Repetitions 335  
           Do While…Loop Loops 335  
           Do…Loop While Loops 339  
           Do Until…Loop Loops 341  
           Do…Loop Until Loops 343  
           Using an Exit Do Statement 345  
           Is the Exit Do Statement Bad Practice? 345  
        While…Wend Loops 346  
        Nesting Loops 347  
        Avoiding Infinite Loops 350  
        The Bottom Line 350  
  Part 4 Using Message Boxes, Input Boxes, and Dialog Boxes 353  
     Chapter 13 Getting User Input with Message Boxes and Input Boxes 355  
        Opening a Macro 356  
        Displaying Status-Bar Messages in Word and Excel 357  
        Message Boxes 359  
           The Pros and Cons of Message Boxes 359  
           Message-Box Syntax 359  
           Displaying a Simple Message Box 360  
           Displaying a Multiline Message Box 361  
           Choosing Buttons for a Message Box 362  
           Choosing an Icon for a Message Box 363  
           Setting a Default Button for a Message Box 364  
           Controlling the Modality of a Message Box 366  
           Specifying a Title for a Message Box 367  
           Title Bars Can Provide Useful Information 367  
           Adding a Help Button to a Message Box 368  
           Specifying a Help File for a Message Box 368  
           Using Some Arguments Without Others 369  
           Retrieving a Value from a Message Box 370  
        Input Boxes 371  
           Input-Box Syntax 372  
           Retrieving Input from an Input Box 373  
        Forms: When Message Boxes and Input Boxes Won’t Suffice 374  
        The Bottom Line 374  
     Chapter 14 Creating Simple Custom Dialog Boxes 377  
        When Should You Use a Custom Dialog Box? 377  
        Creating a Custom Dialog Box 378  
           Designing a Dialog Box 380  
           Inserting a User Form 380  
           Renaming a User Form 383  
           Adding Controls to the User Form 385  
           Grouping Controls 389  
           Renaming Controls 390  
           Moving a Control 391  
           Changing the Caption on a Control 392  
           Key Properties of the Toolbox Controls 394  
        Working with Groups of Controls 412  
           Aligning Controls 415  
           Placing Controls 416  
           Adjusting the Tab Order of a Form 416  
        Linking a Form to a Procedure 418  
           Loading and Unloading a Form 419  
           Displaying and Hiding a Form 419  
           Setting a Default Command Button 420  
        Retrieving the User’s Choices from a Dialog Box 420  
           Returning a String from a Text Box 420  
           Returning a Value from an Option Button 421  
           Returning a Value from a Check Box 422  
           Returning a Value from a List Box 422  
           Returning a Value from a Combo Box 423  
        Examples of Connecting Forms to Procedures 424  
           Word Example: The Move-Paragraph Procedure 424  
           General Example: Opening a File from a List Box 435  
           Creating the Code for the User Form 437  
        Using an Application’s Built-In Dialog Boxes from VBA 440  
           Displaying a Built-In Dialog Box 441  
           Setting and Restoring Options in a Built-In Dialog Box 445  
           Which Button Did the User Choose in a Dialog Box? 445  
           Specifying a Time-Out for a Dialog Box 446  
        The Bottom Line 446  
     Chapter 15 Creating Complex Forms 449  
        Creating and Working with Complex Dialog Boxes 450  
           Updating a Dialog Box to Reflect the User’s Choices 450  
           Revealing a Hidden Part of a Form 450  
           Tracking a Procedure in a Form 455  
           Using Multipage Dialog Boxes and TabStrip Controls 458  
           Creating a Modeless Dialog Box 469  
           Specifying a Form’s Location Onscreen 470  
        Using Events to Control Forms 470  
           Events Unique to the UserForm Object 474  
           Events That Apply to Both UserForms and Container Controls 478  
           Events That Apply to Many or Most Controls 483  
           Events That Apply Only to a Few Controls 496  
        The Bottom Line 497  
  Part 5 Creating Effective Code 499  
     Chapter 16 Building Modular Code and Using Classes 501  
        Creating Modular Code 501  
           What Is Modular Code? 501  
           Advantages of Using Modular Code 502  
           How to Approach Creating Modular Code 502  
           Arranging Your Code in Modules 503  
           Calling a Procedure 503  
           Making Logical Improvements to Your Code 505  
           Making Visual Improvements to Your Code 512  
        Creating and Using Classes 518  
           What Can You Do with Class Modules? 518  
           A Brief Overview of Classes 519  
           Planning Your Class 519  
           Creating a Class Module 520  
           Naming the Class 520  
           Setting the Instancing Property 520  
           Declaring Variables and Constants for the Class 521  
           Adding Properties to the Class 521  
           Adding Methods to a Class 526  
           Using Your Class 527  
        The Bottom Line 529  
     Chapter 17 Debugging Your Code and Handling Errors 531  
        Principles of Debugging 531  
        The Different Types of Errors 533  
           Language Errors 533  
           Compile Errors 533  
           Runtime Errors 536  
           Program Logic Errors 537  
        VBA’s Debugging Tools 538  
           Break Mode 539  
           The Step Over and Step Out Commands 540  
           The Locals Window 541  
           The Watch Window 542  
           The Immediate Window 546  
           The Call Stack Dialog Box 548  
        Dealing with Infinite Loops 548  
        Dealing with Runtime Errors 549  
           When Should You Write an Error Handler? 549  
           Trapping an Error 550  
           Disabling an Error Trap 552  
           Resuming After an Error 552  
           Getting a Description of an Error 556  
           Raising Your Own Errors 556  
        Suppressing Alerts 556  
        Handling User Interrupts in Word, Excel, and Project 557  
           Disabling User Input While a Procedure Is Running 557  
           Disabling User Input While Part of a Macro Is Running 558  
        Documenting Your Code 558  
        The Bottom Line 560  
     Chapter 18 Building Well-Behaved Code 561  
        What Is a Well-Behaved Procedure? 561  
        Retaining or Restoring the User Environment 562  
        Leaving the User in the Best Position to Continue Working 563  
        Keeping the User Informed During the Procedure 564  
           Manipulating the Cursor 566  
           Displaying Information at the Beginning of a Procedure 567  
           Communicating with the User via a Message Box or Dialog Box at the End of a Procedure 568  
           Creating a Log File 568  
        Making Sure a Procedure Is Running Under Suitable Conditions 572  
        Cleaning Up After a Procedure 572  
           Undoing Changes the Procedure Has Made 572  
           Removing Scratch Files and Folders 573  
        The Bottom Line 574  
     Chapter 19 Exploring VBA’s Security Features 577  
        Understanding How VBA Implements Security 577  
        Signing Your Macro Projects with Digital Signatures 581  
           What Is a Digital Certificate? 581  
           Getting a Digital Certificate 582  
        Choosing a Suitable Level of Security 591  
           Understanding the Security Threats Posed by VBA 591  
           Protecting Against Macro Viruses 592  
           Specifying a Suitable Security Setting 592  
           Additional Office Security Features 593  
        Locking Your Code 596  
        The Bottom Line 597  
  Part 6 Programming the Office Applications 599  
     Chapter 20 Understanding the Word Object Model and Key Objects 601  
        Examining the Word Object Model 601  
        Working with the Documents Collection and the Document Object 604  
           Creating a Document 605  
           Creating a Template 605  
        Saving a Document 606  
        Opening a Document 612  
        Closing a Document 616  
           Changing a Document’s Template 616  
        Printing a Document 616  
        Working with the ActiveDocument Object 618  
        Working with the Selection Object 619  
           Checking the Type of Selection 620  
           Checking the Story Type of the Selection 621  
           Getting Other Information About the Current Selection 622  
           Inserting Text at a Selection 626  
           Inserting a Paragraph in a Selection 627  
           Applying a Style 627  
           Extending a Selection 628  
           Collapsing a Selection 629  
        Creating and Using Ranges 629  
           Defining a Named Range 630  
           Redefining a Range 631  
           Using the Duplicate Property to Store or Copy Formatting 631  
        Manipulating Options 631  
           Making Sure Hyperlinks Require Ctrl+Clicking 631  
           Turning Off Overtype 632  
           Setting a Default File Path 632  
           Turning Off Track Changes 633  
           Accessing OneNote 633  
        The Bottom Line 634  
     Chapter 21 Working with Widely Used Objects in Word 637  
        Using Find and Replace via VBA 637  
           Understanding the Syntax of the Execute Method 639  
           Putting Find and Replace to Work 642  
        Working with Headers, Footers, and Page Numbers 643  
           Understanding How VBA Implements Headers and Footers 644  
           Getting to a Header or Footer 644  
           Checking to See If a Header or Footer Exists 644  
           Linking to the Header or Footer in the Previous Section 645  
           Creating a Different First-Page Header 645  
           Creating Different Odd- and Even-Page Headers 645  
           Adding Page Numbers to Your Headers and Footers 646  
        Working with Sections, Page Setup, Windows, and Views 650  
           Adding a Section to a Document 650  
           Changing the Page Setup 651  
           Opening a New Window Containing an Open Document 651  
           Closing All Windows Except the First for a Document 652  
           Splitting a Window 652  
           Displaying the Document Map for a Window 652  
           Scrolling a Window 653  
           Arranging Windows 653  
           Positioning and Sizing a Window 653  
           Making Sure an Item Is Displayed in the Window 654  
           Changing a Document’s View 654  
           Switching to Read Mode 655  
           Zooming the View to Display Multiple Pages 655  
        Working with Tables 655  
           Creating a Table 656  
           Selecting a Table 657  
           Converting Text to a Table 657  
           Ensuring That a Selection Is Within a Table 659  
           Finding Out Where a Selection Is Within a Table 659  
           Sorting a Table 660  
           Adding a Column to a Table 661  
           Deleting a Column from a Table 662  
           Setting the Width of a Column 662  
           Selecting a Column 663  
           Adding a Row to a Table 663  
           Deleting a Row from a Table 663  
           Setting the Height of One or More Rows 664  
           Selecting a Row 664  
           Inserting a Cell 664  
           Returning the Text in a Cell 665  
           Entering Text in a Cell 665  
           Deleting Cells 665  
           Selecting a Range of Cells 666  
           Converting a Table or Rows to Text 667  
        The Bottom Line 668  
     Chapter 22 Understanding the Excel Object Model and Key Objects 671  
        Getting an Overview of the Excel Object Model 671  
        Understanding Excel’s Creatable Objects 672  
        Managing Workbooks 673  
           Creating a Workbook 673  
           Saving a Workbook 675  
           Accessing Cloud Storage 677  
           Opening a Workbook 678  
           Closing a Workbook 680  
           Sharing a Workbook 681  
           Protecting a Workbook 681  
           Working with the ActiveWorkbook Object 682  
        Working with Worksheets 682  
           Inserting a Worksheet 683  
           Deleting a Worksheet 683  
           Copying or Moving a Worksheet 684  
           Printing a Worksheet 685  
           Protecting a Worksheet 686  
           Working with the ActiveSheet Object 687  
        Working with the Active Cell or Selection 687  
           Working with the Active Cell 688  
           Working with the User’s Selection 690  
        Working with Ranges 690  
           Working with a Range of Cells 690  
           Creating a Named Range 690  
           Deleting a Named Range 691  
           Working with a Named Range 692  
           Working with the Used Range 692  
           Working with SpecialCells 692  
           Entering a Formula in a Cell 693  
        Setting Options 694  
           Setting Options in the Application Object 694  
           Setting Options in a Workbook 695  
           Accessing OneNote 695  
        The Bottom Line 696  
     Chapter 23 Working with Widely Used Objects in Excel 699  
        Working with Charts 699  
           Creating a Chart 699  
           Specifying the Source Data for the Chart 701  
           Specifying a Chart Type 701  
           Working with Series in the Chart 701  
           Adding a Legend to the Chart 704  
           Adding a Chart Title 704  
           Working with a Chart Axis 705  
           Formatting Headers and Footers 705  
        Working with Windows Objects 706  
           Opening a New Window on a Workbook 706  
           Closing a Window 706  
           Activating a Window 706  
           Arranging and Resizing Windows 707  
           Zooming a Window and Setting Display Options 708  
        Working with Find and Replace 709  
           Searching with the Find Method 709  
           Continuing a Search with the FindNext and FindPrevious Methods 710  
           Replacing with the Replace Method 711  
           Searching for and Replacing Formatting 711  
        Adding Shapes 712  
        The Bottom Line 712  
     Chapter 24 Understanding the PowerPoint Object Model and Key Objects 713  
        Getting an Overview of the PowerPoint Object Model 713  
        Understanding PowerPoint’s Creatable Objects 714  
        Working with Presentations 715  
           Creating a New Presentation Based on the Default Template 715  
           Creating a New Presentation Based on a Template 716  
           Opening an Existing Presentation 717  
           Opening a Presentation from the Cloud 717  
           Saving a Presentation 718  
           Closing a Presentation 720  
           Exporting a Presentation or Some Slides to Graphics 721  
           Printing a Presentation 721  
           Applying a Template to a Presentation, to a Slide, or to a Range of Slides 722  
           Working with the Active Presentation 723  
        Working with Windows and Views 723  
           Working with the Active Window 724  
           Opening a New Window on a Presentation 724  
           Closing a Window 724  
           Activating a Window 725  
           Arranging and Resizing Windows 725  
           Changing the View 726  
           Working with Panes 726  
        Working with Slides 726  
           Adding a Slide to a Presentation 727  
           Inserting Slides from an Existing Presentation 728  
           Finding a Slide by Its ID Number 728  
           Changing the Layout of an Existing Slide 729  
           Deleting an Existing Slide 729  
           Copying and Pasting a Slide 729  
           Duplicating a Slide 729  
           Moving a Slide 730  
           Accessing a Slide by Name 730  
           Working with a Range of Slides 730  
           Formatting a Slide 731  
           Setting a Transition for a Slide, a Range of Slides, or a Master 732  
        Working with Masters 733  
           Working with the Slide Master 733  
           Working with the Title Master 734  
           Working with the Handout Master 734  
           Working with the Notes Master 734  
           Deleting a Master 735  
        The Bottom Line 735  
     Chapter 25 Working with Shapes and Running Slide Shows 737  
        Working with Shapes 737  
           Adding Shapes to Slides 737  
           Deleting a Shape 743  
           Selecting All Shapes 743  
           Repositioning and Resizing a Shape 743  
           Copying Formatting from One Shape to Another 744  
           Working with Text in a Shape 744  
           Animating a Shape or a Range of Shapes 749  
        Working with Headers and Footers 751  
           Returning the Header or Footer Object You Want 751  
           Displaying or Hiding a Header or Footer Object 751  
           Setting the Text in a Header or Footer 752  
           Setting the Format for Date and Time Headers and Footers 752  
        Setting Up and Running a Slide Show 753  
           Controlling the Show Type 753  
           Creating a Custom Show 754  
           Deleting a Custom Show 755  
           Starting a Slide Show 755  
           Changing the Size and Position of a Slide Show 755  
           Moving from Slide to Slide 756  
           Pausing the Show and Using White and Black Screens 756  
           Starting and Stopping Custom Shows 757  
           Exiting a Slide Show 757  
        The Bottom Line 757  
     Chapter 26 Understanding the Outlook Object Model and Key Objects 759  
        Getting an Overview of the Outlook Object Model 759  
           Understanding Where Outlook Stores VBA Macros 760  
           Understanding Outlook’s Most Common Creatable Objects 760  
        Working with the Application Object 761  
           Introducing the NameSpace Object 762  
           Working with Inspectors and Explorers 762  
           Understanding Inspectors and Explorers 764  
           Creating Items 766  
           Quitting Outlook 767  
        Understanding General Methods for Working with Outlook Objects 767  
           Using the Display Method 767  
           Using the Close Method 768  
           Using the PrintOut Method 769  
           Using the Save Method 769  
           Using the SaveAs Method 770  
        Working with Messages 771  
           Creating a New Message 771  
           Working with the Contents of a Message 771  
           Adding an Attachment to a Message 772  
           Sending a Message 773  
        Working with Calendar Items 774  
           Creating a New Calendar Item 774  
           Working with the Contents of a Calendar Item 774  
        Working with Tasks and Task Requests 775  
           Creating a Task 775  
           Working with the Contents of a Task Item 775  
           Assigning a Task to a Colleague 776  
        Searching for Items 777  
        The Bottom Line 778  
     Chapter 27 Working with Events in Outlook 781  
        Working with Application-Level Events 782  
           Using the Startup Event 784  
           Using the Quit Event 784  
           Using the ItemSend Event 785  
           Using the NewMail Event 786  
           Using the AdvancedSearchComplete and the AdvancedSearchStopped Events 786  
           Using the MAPILogonComplete Event 787  
           Using the Reminder Event 788  
           Using the OptionsPagesAdd Event 788  
        Working with Item-Level Events 788  
           Declaring an Object Variable and Initializing an Event 789  
           Understanding the Events That Apply to All Message Items 790  
           Understanding the Events That Apply to Explorers, Inspectors, and Views 792  
           Understanding the Events That Apply to Folders 796  
           Understanding the Events That Apply to Items and Results Objects 797  
           Understanding the Events That Apply to Reminders 797  
           Understanding the Events That Apply to Synchronization 798  
        Understanding Quick Steps 798  
        The Bottom Line 799  
     Chapter 28 Understanding the Access Object Model and Key Objects 801  
        Getting Started with VBA in Access 801  
           Creating a Module in the VBA Editor 803  
           Creating a Function 803  
           Using the Macro Designer 803  
           Creating an Access-Style Macro to Run a Function 803  
           Translating an Access-Style Macro into a VBA Macro 805  
           Using an AutoExec Macro to Initialize an Access Session 807  
           Running a Subprocedure 807  
           Understanding the Option Compare Database Statement 808  
        Getting an Overview of the Access Object Model 808  
        Understanding Creatable Objects in Access 809  
        Opening and Closing Databases 810  
           Using the CurrentDb Method to Return the Current Database 810  
           Closing the Current Database and Opening a Different Database 810  
           Communicating Between Office Applications 813  
           Opening Multiple Databases at Once 814  
           Closing a Database 816  
           Creating and Removing Workspaces 816  
        Working with the Screen Object 817  
        Using the DoCmd Object to Run Access Commands 818  
           Using the OpenForm Method to Open a Form 822  
           Using the PrintOut Method to Print an Object 823  
           Using the RunMacro Method to Run an Access-Style Macro 824  
        The Bottom Line 824  
     Chapter 29 Manipulating the Data in an Access Database via VBA 827  
        Understanding How to Proceed 827  
        Preparing to Manage the Data in a Database 828  
           Adding a Reference to the Appropriate Object Library 828  
           Establishing a Connection to the Database 829  
        Opening a Recordset 829  
           Opening a Recordset Using ADO 829  
           Choosing How to Access the Data in an ADO Recordset 832  
        Accessing a Particular Record in a Recordset 840  
           Using the MoveFirst, MoveNext, MovePrevious, and MoveLast Methods 840  
           Using the Move Method to Move Past Multiple Records 841  
        Searching for a Record 842  
           Searching for a Record in an ADO Recordset 842  
           Searching for a Record in a DAO Recordset 844  
        Returning the Fields in a Record 845  
        Editing a Record 845  
        Inserting and Deleting Records 845  
        Closing a Recordset 846  
        Saving a Recordset to the Cloud 846  
        The Bottom Line 848  
     Chapter 30 Accessing One Application from Another Application 849  
        Understanding the Tools Used to Communicate Between Applications 849  
        Using Automation to Transfer Information 850  
           Understanding Early and Late Binding 851  
           Creating an Object with the CreateObject Function 852  
           Returning an Object with the GetObject Function 853  
           Examples of Using Automation with the Office Applications 853  
        Using the Shell Function to Run an Application 862  
        Using Data Objects to Store and Retrieve Information 864  
           Creating a Data Object 864  
           Storing Information in a Data Object 865  
           Returning Information from a Data Object 865  
           Assigning Information to the Clipboard 866  
           Finding Out Whether a Data Object Contains a Given Format 866  
        Communicating via DDE 867  
           Using DDEInitiate to Start a DDE Connection 867  
           Using DDERequest to Return Text from Another Application 868  
           Using DDEPoke to Send Text to Another Application 869  
           Using DDEExecute to Have One Application Execute a Command in Another 870  
           Using DDETerminate to Close a DDE Channel 870  
           Using DDETerminateAll to Close All Open DDE Channels 871  
        Communicating via SendKeys 871  
        Going Beyond VBA 875  
        The Bottom Line 876  
     Chapter 31 Programming the Office 2016 Ribbon 877  
        What Is XML? 878  
        Hiding the Clipboard Group on the Word Ribbon 879  
           A Word of Warning 885  
           XML Terminology 885  
           Using Built-In Icons 886  
        Working with Excel and PowerPoint 886  
        Undoing Ribbon Modifications 887  
        Selecting the Scope of Your Ribbon Customization 887  
        Adding a New Group 888  
           Cautions About Customizing 888  
           Two Ways to Find the Correct idMso 890  
        Adding Callbacks 891  
        Adding Attributes 893  
           Using Built-In Icons and ScreenTips 893  
           Creating Your Own Icons 894  
        Using Menus and Lists 895  
           Adding Menus 895  
           Adding a DropDown List Control 897  
           Using a DialogBoxLauncher 899  
        Toggling with a Toggle-Button Control 900  
        Modifying the Ribbon in Access 901  
           Testing Your New Ribbon 903  
        Adding a Callback in Access 905  
        What to Look For If Things Go Wrong 906  
           Employ Error-Message Tools 906  
           Cure Common User-Interface Programming Problems 907  
        Where to Go from Here 909  
        The Bottom Line 910  
  Appendix The Bottom Line 911  
     Chapter 1: Recording and Running Macros in the Office Applications 911  
     Chapter 2: Getting Started with the Visual Basic Editor 912  
     Chapter 3: Editing Recorded Macros 913  
     Chapter 4: Creating Code from Scratch in the Visual Basic Editor 914  
     Chapter 5: Understanding the Essentials of VBA Syntax 916  
     Chapter 6: Working with Variables, Constants, and Enumerations 918  
     Chapter 7: Using Array Variables 920  
     Chapter 8: Finding the Objects, Methods, and Properties You Need 921  
     Chapter 9: Using Built-in Functions 922  
     Chapter 10: Creating Your Own Functions 923  
     Chapter 11: Making Decisions in Your Code 925  
     Chapter 12: Using Loops to Repeat Actions 926  
     Chapter 13: Getting User Input with Message Boxes and Input Boxes 927  
     Chapter 14: Creating Simple Custom Dialog Boxes 929  
     Chapter 15: Creating Complex Forms 932  
     Chapter 16: Building Modular Code and Using Classes 934  
     Chapter 17: Debugging Your Code and Handling Errors 935  
     Chapter 18: Building Well-Behaved Code 937  
     Chapter 19: Exploring VBA’s Security Features 938  
     Chapter 20: Understanding the Word Object Model and Key Objects 940  
     Chapter 21: Working with Widely Used Objects in Word 941  
     Chapter 22: Understanding the Excel Object Model and Key Objects 942  
     Chapter 23: Working with Widely Used Objects in Excel 943  
     Chapter 24: Understanding the PowerPoint Object Model and Key Objects 944  
     Chapter 25: Working with Shapes and Running Slide Shows 945  
     Chapter 26: Understanding the Outlook Object Model and Key Objects 946  
     Chapter 27: Working with Events in Outlook 946  
     Chapter 28: Understanding the Access Object Model and Key Objects 947  
     Chapter 29: Manipulating the Data in an Access Database via VBA 949  
     Chapter 30: Accessing One Application from Another Application 950  
     Chapter 31: Programming the Office 2016 Ribbon 951  
  Index 953  
  EULA 987  


nach oben


  Mehr zum Inhalt
Kapitelübersicht
Kurzinformation
Inhaltsverzeichnis
Leseprobe
Blick ins Buch
Fragen zu eBooks?

  Navigation
Belletristik / Romane
Computer
Geschichte
Kultur
Medizin / Gesundheit
Philosophie / Religion
Politik
Psychologie / Pädagogik
Ratgeber
Recht
Reise / Hobbys
Technik / Wissen
Wirtschaft

© 2008-2024 ciando GmbH | Impressum | Kontakt | F.A.Q. | Datenschutz