Cargando…

Mastering VBA for Office 2010 /

"A comprehensive guide to the language used to customize Microsoft Office Visual Basic for Applications (VBA) is the language used for writing macros, automating Office applications, and creating custom applications in Word, Excel, PowerPoint, Outlook, and Access. This complete guide shows both...

Descripción completa

Detalles Bibliográficos
Clasificación:Libro Electrónico
Autor principal: Mansfield, Richard, 1945-
Formato: Electrónico eBook
Idioma:Inglés
Publicado: Indianapolis, IN : Wiley Pub., 2010.
Edición:1st ed.
Colección:Serious skills.
Temas:
Acceso en línea:Texto completo
Texto completo
Tabla de Contenidos:
  • Note continued: How to Approach Creating Modular Code
  • Arranging Your Code in Modules
  • Calling a Procedure
  • Making Logical Improvements to Your Code
  • Making Visual Improvements to Your Code
  • Creating and Using Classes
  • What Can You Do with Class Modules?
  • A Brief Overview
  • Planning Your Class
  • Creating the Class Module
  • Naming the Class
  • Setting the Instancing Property
  • Declaring Variables and Constants for the Class
  • Adding Properties to the Class
  • Adding Methods to the Class
  • Using Your Class
  • The Bottom Line
  • ch. 17 Debugging Your Code and Handling Errors
  • Principles of Debugging
  • The Different Types of Errors
  • Language Errors
  • Compile Errors
  • Runtime Errors
  • Program Logic Errors
  • VBA's Debugging Tools
  • Break Mode
  • The Step Over and Step Out Commands
  • The Locals Window
  • The Watch Window
  • The Immediate Window
  • The Call Stack Dialog Box
  • Dealing with Infinite Loops
  • Dealing with Runtime Errors
  • When Should You Write an Error Handler?
  • Trapping an Error
  • Disabling an Error Trap
  • Resuming after an Error
  • Getting a Description of an Error
  • Raising Your Own Errors
  • Suppressing Alerts
  • Handling User Interrupts in Word, Excel, and Project
  • Disabling User Input While a Procedure Is Running
  • Disabling User Input While Part of a Procedure Is Running
  • Documenting Your Code
  • The Bottom Line
  • ch. 18 Building Well-Behaved Code
  • What is a Well-Behaved Procedure?
  • Retaining or Restoring the User Environment
  • Leaving the User in the Best Position to Continue Working
  • Keeping the User Informed during the Procedure
  • Manipulating the Cursor
  • Displaying Information at the Beginning of a Procedure
  • Communicating with the User via a Message Box or Dialog Box at the End of a Procedure
  • Creating a Log File
  • Making Sure a Procedure Is Running under Suitable Conditions
  • Cleaning Up after a Procedure
  • Undoing Changes the Procedure Has Made
  • Removing Scratch Files and Folders
  • The Bottom Line
  • ch. 19 Securing Your Code with VBA's Security Features
  • Understanding How VBA Implements Security
  • Signing Your Macro Projects with Digital Signatures
  • What Is a Digital Certificate?
  • Getting a Digital Certificate
  • Choosing a Suitable Level of Security
  • Understanding the Security Threats Posed by VBA
  • Protecting against Macro Viruses
  • Specifying a Suitable Security Setting
  • New Security in Office 2010
  • Specifying Whom to Trust
  • Locking Your Code
  • The Bottom Line
  • pt. 6 Programming the Office Applications
  • ch. 20 Understanding the Word Object Model and Key Objects
  • Examining the Word Object Model
  • Working with the Documents Collection and the Document Object
  • Creating a Document
  • Creating a Template
  • Saving a Document
  • Opening a Document
  • Closing a Document
  • Changing a Document's Template
  • Printing a Document
  • Working with the ActiveDocument Object
  • Working with the Selection Object
  • Checking the Type of Selection
  • Checking the Story Type of the Selection
  • Getting Other Information about the Current Selection
  • Inserting Text at, after, or before the Selection
  • Inserting a Paragraph in a Selection
  • Applying a Style
  • Extending a Selection
  • Collapsing a Selection
  • Creating and Using Ranges
  • Defining a Named Range
  • Redefining a Range
  • Using the Duplicate Property to Store or Copy Formatting
  • Manipulating Options
  • Making Sure Hyperlinks Require Ctrl+Clicking
  • Turning Off Overtype
  • Setting a Default File Path
  • Turning Off Track Changes
  • The Bottom Line
  • ch. 21 Working with Widely Used Objects in Word
  • Using Find and Replace via VBA
  • Understanding the Syntax for the Execute Method
  • Putting Find and Replace to Work
  • Working with Headers, Footers, and Page Numbers
  • Understanding How VBA Implements Headers and Footers
  • Getting to a Header or Footer
  • Checking to See If a Header or Footer Exists
  • Linking to the Header or Footer in the Previous Section
  • Creating a Different First-Page Header
  • Creating Different Odd-and Even-Page Headers
  • Adding Page Numbers to Your Headers and Footers
  • Working with Sections, Page Setup, Windows, and Views
  • Adding a Section to a Document
  • Changing the Page Setup
  • Opening a New Window Containing an Open Document
  • Closing All Windows for a Document Except the First
  • Splitting a Window
  • Displaying the Document Map for a Window
  • Scrolling a Window
  • Arranging Windows
  • Positioning and Sizing a Window
  • Making Sure an Item Is Displayed in the Window
  • Changing a Document's View
  • Zooming the View to Display Multiple Pages
  • Working with Tables
  • Creating a Table
  • Selecting a Table
  • Converting Text to a Table
  • Making Sure the Selection Is withing a Table
  • Finding Out Where a Selection Is within a Table
  • Sorting a Table
  • Adding a Column to a Table
  • Deleting a Column from a Table
  • Setting the Width of a Column
  • Selecting a Column
  • Adding a Row to a Table
  • Deleting a Row from a Table
  • Setting the Height of One or More Rows
  • Selecting a Row
  • Inserting a Cell
  • Returning the Text within a Cell
  • Entering Text in a Cell
  • Deleting Cells
  • Selecting a Range of Cells
  • Converting a Table or Rows to Text
  • The Bottom Line
  • ch. 22 Understanding the Excel Object Model and Key Objects
  • Getting an Overview of the Excel Object Model
  • Understanding Excel's Creatable Objects
  • Managing Workbooks
  • Creating a Workbook
  • Saving a Workbook
  • Opening a Workbook
  • Closing a Workbook
  • Sharing a Workbook
  • Protecting a Workbook
  • Working with the ActiveWorkbook Object
  • Working with Worksheets
  • Inserting a Worksheet
  • Deleting a Worksheet
  • Copying or Moving a Worksheet
  • Printing a Worksheet
  • Protecting a Worksheet
  • Working with the ActiveSheet Object
  • Working with the Active Cell or Selection
  • Working with the Active Cell
  • Working with the User's Selection
  • Working with Ranges
  • Working with a Range of Cells
  • Creating a Named Range
  • Deleting a Named Range
  • Working with a Named Range
  • Working with the Used Range
  • Working with the Special Cells
  • Entering a Formula in a Cell
  • Setting Options
  • Setting Options in the Application Object
  • Setting Options in a Workbook
  • The Bottom Line
  • ch. 23 Working with Widely Used Objects in Excel
  • Working with Charts
  • Creating a Chart
  • Specifying the Source Data for the Chart
  • Specifying the Chart Type
  • Working with Series in the Chart
  • Adding a Legend to the Chart
  • Adding a Chart Title
  • Working with a Chart Axis
  • Working with Windows
  • Opening a New Window on a Workbook
  • Closing a Window
  • Activating a Window
  • Arranging and Resizing Windows
  • Zooming a Window and Setting Display Options
  • Working with Find and Replace
  • Searching with the Find Method
  • Continuing a Search with the FindNext and FindPrevious Methods
  • Replacing with the Replace Method
  • Searching for and Replacing Formatting
  • Adding Shapes
  • The Bottom Line
  • ch. 24 Understanding the PowerPoint Object Model and Key Objects
  • Getting an Overview of the PowerPoint Object Model
  • Understanding PowerPoint's Creatable Objects
  • Working with Presentations
  • Creating a New Presentation Based on the Default Template
  • Creating a New Presentation Based on a Template
  • Opening an Existing Presentation
  • Saving a Presentation
  • Closing a Presentation
  • Exporting a Presentation or Some Slides to Graphics
  • Printing a Presentation
  • Applying a Template to a Presentation, to a Slide, or to a Range of Slides
  • Working with the Active Presentation
  • Working with Windows and Views
  • Working with the Active Window
  • Opening a New Window on a Presentation
  • Closing a Window
  • Activating a Window
  • Arranging and Resizing Windows
  • Changing the View
  • Working with Panes
  • Working with Slides
  • Adding a Slide to a Presentation
  • Inserting Slides from an Existing Presentation
  • Finding a Slide by Its ID Number
  • Changing the Layout of an Existing Slide
  • Deleting an Existing Slide
  • Copying and Pasting a Slide
  • Duplicating a Slide
  • Moving a Slide
  • Accessing a Slide by Name
  • Working with a Range of Slides
  • Formating a Slide
  • Setting a Transition for a Slide, a Range of Slides, or a Master
  • Working with Masters
  • Working with the Slide Master
  • Working with the Title Master
  • Working with the Handout Master
  • Working with the Notes Master
  • Deleting a Master
  • The Bottom Line
  • ch.
  • 25 Working with Shapes and Running Slide Shows
  • Working with Shapes
  • Adding Shapes to Slides
  • Deleting a Shape
  • Selecting All Shapes
  • Repositioning and Resizing a Shape
  • Copying Formatting from One Shape to Another
  • Working with Text in a Shape
  • Setting an Animation for a Shape or a Range of Shapes
  • Working with Headers and Footers
  • Returning the Header or Footer Object You Want
  • Displaying or Hiding a Header or Footer Object
  • Setting the Text in a Header or Footer
  • Setting the Format for Date and Time Headers and Footers
  • Setting Up and Running a Slide Show
  • Controlling the Show Type
  • Creating a Custom Show
  • Deleting a Custom Show
  • Starting a Slide Show
  • Changing the Size and Position of the Slide Show
  • Moving from Slide to Slide
  • Pausing the Show and Using White and Black Screens
  • Starting and Stopping Custom Shows
  • Exiting the Slide Show
  • The Bottom Line
  • ch. 26 Understanding the Outlook Object Model and Key Objects
  • Getting an Overview of the Outlook Object Model
  • Understanding Where Outlook Stores VBA Items
  • Understanding Outlook's Creatable Objects and Main User Interface Items
  • Working with the Application Object
  • Working with the NameSpace Object
  • Working with Inspectors and Explorers
  • Creating Items
  • Quitting Outlook
  • Understanding General Methods for Working with Outlook Objects
  • Using the Display Method
  • Using the Close Method
  • Using the Delete Method.
  • Note continued: Using the PrintOut Method
  • Using the Save Method
  • Using the SaveAs Method
  • Working with Messages
  • Creating a New Message
  • Working with the Contents of a Message
  • Adding an Attachment to a Message
  • Sending a Message
  • Working with Calendar Items
  • Creating a New Calendar Item
  • Working with the Contents of a Calendar Item
  • Working with Tasks and Task Requests
  • Creating a Task
  • Working with the Contents of a Task Item
  • Assigning a Task to a Colleague
  • Searching for Items
  • The Bottom Line
  • ch. 27 Working with Events in Outlook
  • Working with Application-Level Events
  • Using the Startup Event
  • Using the Quit Event
  • Using the ItemSend Event
  • Using the NewMail and NewMailEx Events
  • Using the AdvancedSearchComplete and the AdvancedSearchStopped Events
  • Using the MAPILogon Complete Event
  • Using the Reminder Event
  • Using the OptionsPagesAdd Event
  • Working with Item-Level Events
  • Declaring an Object Variable and Initializing an Event
  • Understanding the Events That Apply to All Message Items
  • Understanding the Events That Apply to Explorers, Inspectors, and Views
  • Understanding the Events That Apply to Folders
  • Understanding the Events That Apply to Items and Results
  • Understanding the Events That Apply to the Outlook Bar
  • Understanding the Events That Apply to Reminders
  • Understanding the Events That Apply to Synchronization
  • Understanding Quick Steps
  • The Bottom Line
  • ch. 28 Understanding the Access Object Model and Key Objects
  • Getting Started with VBA in Access
  • Creating a Module in the VBA Editor
  • Creating a Function
  • The Revamped Macro Builder
  • Creating an Access-Style Macro to Run a Function
  • Using an AutoExec Macro to Initialize an Access Session
  • Running a Subprocedure
  • Understanding the Option Compare Database Statement
  • Getting an Overview of the Access Object Model
  • Understanding Creatable Objects in Access
  • Opening and Closing Databases
  • Using the CurrentDb Method to Return the Current Database
  • Opening a Different Database as the Current Database and Closing the Current Database
  • Opening Multiple Databases at Once
  • Closing a Database
  • Creating and Removing Workspaces
  • Working with the Screen Object
  • Using the DoCmd Object to Run Access Commands
  • Using the OpenForm Method to Open a Form
  • Using the PrintOut Method to Print an Object
  • Using the RunMacro Method to Run a Macro
  • The Bottom Line
  • ch. 29 Manipulating the Data in an Access Database via VBA
  • Understanding How to Proceed
  • Preparing to Manage the Data in a Database
  • Adding a Reference to the Appropriate Object Library
  • Establishing a Connection to the Database
  • Opening a Recordset
  • Opening a Recordset Using ADO
  • Choosing How to Access the Data in an ADO Recordset
  • Opening a Recordset Using DAO
  • Accessing a Particular Record in a Recordset
  • Using the MoveFirst, MoveNext, MovePrevious, and MoveLast Methods
  • Using the Move Method to Move by Multiple Records
  • Searching for a Record
  • Searching for a Record in an ADO Recordset
  • Searching for a Record in a DAO Recordset
  • Returning the Fields in a Record
  • Editing a Record
  • Inserting and Deleting Records
  • Closing a Recordset
  • The Bottom Line
  • ch. 30 Accessing One Application from Another Application
  • Understanding the Tools Used to Communicate between Applications
  • Using Automation to Transfer Information
  • Understanding Early and Late Binding
  • Creating an Object with the CreateObject Function
  • Returning an Object with the GetObject Function
  • Examples of Using Automation with the Office Applications
  • Using the Shell Function to Run an Application
  • Returning the Task ID of the Started Application
  • Activating an Application
  • Using Data Objects to Store and Retrieve Information
  • Creating a Data Object
  • Storing Information in a Data Object
  • Returning Information from a Data Object
  • Assigning Information to the Clipboard
  • Returning Information from the Clipboard to a Data Object
  • Finding Out Whether a Data Object Contains a Given Format
  • Communicating via DDE
  • Using DDEInitiate to Start a DDE Connection
  • Using DDERequest to Return Text from Another Application
  • Using DDEPoke to Send Text to Another Application
  • Using DDEExecute to Execute a Command in Another Application
  • Using DDETerminate to Close a DDE Channel
  • Using DDETerminateAll to Close All Open DDE Channels
  • Communicating via SendKeys
  • The Bottom Line
  • ch. 31 Programming the Office 2010 Ribbon
  • Hiding the Editing Group on the Word Ribbon
  • A Word of Warning
  • XML Terminology
  • Using Built-in Icons
  • Working with Excel and PowerPoint
  • Undoing Ribbon Modifications
  • Selecting the Scope of Your Ribbon Customization
  • Adding a New Group
  • Cautions about Customizing
  • Two Ways to Find the Correct idMso
  • Adding Callbacks
  • Adding Attributes
  • Using Built-in Icons and ScreenTips
  • Creating Your Own Icons
  • Using Menus and Lists
  • Adding Menus
  • Adding a DropDown List Control
  • Using a DialogBoxLauncher
  • Toggling with a Toggle Button Control
  • Modifying the Ribbon in Access
  • Testing Your New Ribbon
  • Adding a Callback in Access
  • What to Look For If Things Go Wrong
  • Employ Error Message Tools
  • Cure Common User Interface Programming Problems
  • Where to Go from Here
  • The Bottom Line
  • Appendix The Bottom Line
  • ch. 1 Recording and Running Macros in the Office Applications
  • ch. 2 Getting Started with the Visual Basic Editor
  • ch. 3 Editing Recorded Macros
  • ch. 4 Creating Code from Scratch in the Visual Basic Editor
  • ch. 5 Understanding the Essentials of VBA Syntax
  • ch. 6 Working with Variables, Constants, and Enumerations
  • ch. 7 Using Array Variables
  • ch. 8 Finding the Objects, Methods, and Properties You Need
  • ch. 9 Using Built-in Functions
  • ch. 10 Creating Your Own Functions
  • ch. 11 Making Decisions in Your Code
  • ch. 12 Using Loops to Repeat Actions
  • ch. 13 Getting User Input with Message Boxes and Input Boxes
  • ch. 14 Creating Simple Custom Dialog Boxes
  • ch. 15 Creating Complex Dialog Boxes
  • ch. 16 Building Modular Code and Using Classes
  • ch. 17 Debugging Your Code and Handling Errors
  • ch. 18 Building Well-Behaved Code
  • ch. 19 Securing Your Code with VBA's Security Features
  • ch. 20 Understanding the Word Object Model and Key Objects
  • ch. 21 Working with Widely Used Objects in Word
  • ch. 22 Understanding the Excel Object Model and Key Objects
  • ch. 23 Working with Widely Used Objects in Excel
  • ch. 24 Understanding the PowerPoint Object Model and Key Objects
  • ch. 25 Working with Shapes and Running Slide Shows
  • ch. 26 Understanding the Outlook Object Model and Key Objects
  • ch. 27 Working with Events in Outlook
  • ch. 28 Understanding the Access Object Model and Key Objects
  • ch. 29 Manipulating the Data in an Access Database via VBA
  • ch. 30 Accessing One Application from Another Application
  • ch. 31 Programming the Office 2010 Ribbon.