Word 2003 Document Automation with VBA, XML, XSLT, and Smart Documents

Book description


While it has always been possible to create customized Word solutions, Word 2003 offers new functionality that allows documents to be truly interactive. Word 2003 Document Automation with VBA, XML, XSLT, and Smart Documents explains how to use a variety of technologies that change the ways users interact with documents.
Learn how to automate documents with a minimum of programming by using Word's native functionality; use Visual Basic for Applications to create document automation solutions; record macros, create automated templates, format and manipulate files using Word, and build documents dynamically; create, edit, and format XML documents; develop smart document solutions to guide users through a variety of repetitive tasks; transform XML using WordprocessingML, XSLT, XPath, smart documents, and web services technologies.

Table of contents

  1. Book Cover
  2. Title
  3. Contents (1/3)
  4. Contents (2/3)
  5. Contents (3/3)
  6. Acknowledgments
  7. Introduction (1/2)
  8. Introduction (2/2)
  9. Chapter 1: Automation Without Programming
    1. Introduction
    2. Why Templates?
      1. Creating a Template
      2. Using Templates
      3. Workgroup Templates
    3. AutoCorrect
      1. Using AutoCorrect
    4. AutoText
      1. Using AutoText
      2. Retrieving Your AutoText
      3. Practical Limitations
    5. Search and Replace
      1. Why Use Search and Replace?
      2. Using Search and Replace
      3. Assuring Replacement
    6. Section Breaks
      1. Why Use Section Breaks?
      2. Inserting a Section Break
      3. Page Numbers
    7. Provision Banks
      1. Organizing a Provision Bank
      2. Saving as a Template
      3. Adding a Hyperlinked Index
    8. Field Basics
      1. What Is a Field?
      2. How Do You View a Field?
      3. Inserting Field Codes
      4. Commonly Used Fields (1/2)
      5. Commonly Used Fields (2/2)
        1. The MacroButton
        2. The AutoTextList Field
        3. Fill-in Fields
        4. Ask Fields
      6. Unlinking or Locking a Field
      7. Updating Fields
      8. More on Switches
        1. Number Switches
        2. Dollar Switches
    9. Conclusion
  10. Chapter 2: Introduction to VBA
    1. Introduction
    2. A Quick Introduction to the Visual Basic Editor (VBE)
      1. VBE Component Basics
        1. Module Window
        2. Project Explorer
        3. Properties Window
      2. VBE Toolbars (1/3)
      3. VBE Toolbars (2/3)
      4. VBE Toolbars (3/3)
        1. Edit Toolbar
        2. Debug Toolbar
        3. Standard Toolbar
        4. UserForm Toolbar
      5. Object Browser
    3. The Visual Basic Environment
      1. Procedures
        1. Functions
        2. Subroutines
        3. Parameters and Arguments
        4. UserForms
        5. VBA Toolbox
      2. Methods
      3. Properties
      4. Modules
      5. Events
      6. Class Modules
    4. Conclusion
  11. Chapter 3: Word 2003 and VBA
    1. Introduction
    2. Word Macros
      1. How Macros Work
      2. Recording a Macro
      3. Planning Macros
      4. Shortcut Keys
      5. Custom Toolbar Buttons
      6. Viewing Available Macros
      7. Macro Errors
      8. Macro Organizer
      9. Macro Security
        1. Warnings
    3. Word’s AutoMacros
      1. AutoExit
      2. AutoClose
      3. AutoNew
      4. AutoOpen
      5. Differentiating Word’s Document Events
      6. Changing Word’s Built-in Macros
    4. Templates
      1. Global Templates
      2. Document Templates
      3. Startup Path
      4. Command-Line Parameters
      5. Add-Ins
      6. Unloading Templates and Add-ins
    5. Fields
    6. Bookmarks
    7. Word VBA Tips
      1. Locking Your VBA Code
      2. Prevent User Macro Interference (with Ctrl + Break)
      3. Distributing VBA Macros
    8. Conclusion
  12. Chapter 4: The Word 2003 Object Model
    1. Introduction
    2. The Application Object
      1. Additions to the Application Object
      2. Properties of the Application Object
      3. Methods of the Application Object
      4. Events of the Application Object
      5. Using Events with the Application Object
        1. Intercepting Application Events
        2. Responding to Application Events
    3. The Documents Collection
      1. Word 2003 Additions to the Document Object
      2. Properties of the Documents Collection
      3. Methods of the Documents Collection
      4. Events of the Documents Collection
      5. Using Properties and Methods
        1. Opening Documents
        2. Programmatically Creating New Documents
        3. Saving Documents
        4. Closing Documents
    4. The Range Object
      1. Word 2003 Additions to the Range Object
      2. Properties of the Range Object
      3. Methods of the Range Object
      4. Utilizing the Range Object
        1. Returning Ranges
    5. The Selection Object
      1. Word 2003 Additions to the Selection Object
      2. Properties of the Selection Object
      3. Methods of the Selection Object
      4. Working with the Selection Object
        1. Returning Selections
        2. Working with Selections
    6. New XML Objects
      1. XMLChildNodeSuggestion Object
        1. Properties
        2. Methods
      2. XMLNamespace Object
        1. Methods
      3. XMLNode Object
        1. Properties
        2. Methods
      4. XMLSchemaReference Object
        1. Properties
        2. Methods
      5. XSLTransform Object
        1. Properties
        2. Methods
    7. The Find and Replace Objects
    8. The Dialogs Object
      1. Show Method
      2. Display Method
      3. Dialog Box Arguments
      4. Dialog Box Return Values
    9. Other Useful Objects
      1. ActivePrinter Object
      2. CommandBar Object
        1. Command Bar Pop-Up Menu Project
      3. HeaderFooter Object
        1. Header/Footer Update
    10. Conclusion
  13. Chapter 5: The VBA Programming Language
    1. Introduction
    2. Variables
      1. Variable Declaration
        1. Local Variable Declaration
        2. Module Level Variable Declaration
        3. Global Level Variable Declaration
      2. Static Variables (1/2)
      3. Static Variables (2/2)
        1. Types of Variables
          1. Byte
          2. Boolean
          3. Integer
          4. Long
          5. Single
          6. Double
          7. Currency
          8. Date
          9. Object
          10. String
          11. Variant
          12. User-Defined Variable Types
    3. Constants
      1. Intrinsic Constants
      2. User-Defined Constants
    4. Collections
    5. Arrays
      1. Multidimensional Arrays
    6. Displaying Information to the User
      1. Message Boxes
        1. Button Settings
        2. Return Values
      2. Input Boxes
    7. String Functions
      1. LCase(string)
      2. UCase(string)
      3. StrConv(string, conversion)
      4. StrComp(string1, string2, [compare])
      5. String(number, character)
      6. Space(number)
      7. Len(string)
      8. InStr([start], string1, string2, [compare])
      9. Mid(string, start, [length])
      10. Left(string, length)
      11. Right(string, length)
      12. Trim(string)
      13. LTrim(string)
      14. RTrim(string)
      15. Chr(charcode)
    8. String Statements
      1. Option Compare {Binary | Text | Database}
        1. Option Compare Binary
        2. Option Compare Text
        3. Option Compare Database
      2. Mid(stringvar, start, [length]) = string
      3. RSet
      4. LSet
    9. Conclusion
  14. Chapter 6: Controlling VBA Code
    1. Introduction
    2. Conditional Statements
      1. If Statements
        1. If…Then
        2. If…Then…Else…End If
        3. If…Then…ElseIf…End If
      2. IIf Function
      3. Select Case
    3. Loops
      1. The For…Next Loop
      2. The For Each…Next Loop
      3. The Do…Loop Statement
      4. The While…Wend Loop
    4. Alternative Flow Control
      1. On…GoTo and On…GoSub
      2. GoSub…Return
      3. Stop
      4. Choose
      5. Partition
      6. End
    5. Arithmetic Operators
      1. Add
      2. Subtract
      3. Multiply
      4. Divide Integer
      5. Divide Floating Point
    6. Logical Operators
      1. AND
      2. NOT
      3. OR
    7. Comparison Operators
      1. IS/LIKE
    8. Concatenation
      1. & Operator
      2. + Operator
      3. Call
    9. Conclusion
  15. Chapter 7: VBA Projects
    1. Introduction
    2. Dynamic Control Creation with VBA
      1. The Conventional Method
      2. A Shortcut Method
      3. A Final Note
    3. Automating Document Creation with Word Templates
      1. What It Does
      2. How It Works
      3. The Newly Created Templates (1/2)
      4. The Newly Created Templates (2/2)
      5. The Template
    4. Conclusion
  16. Chapter 8: Word’s XML Functionality
    1. Introduction
    2. Creating and Using Schemas
    3. Introduction to the XML Toolbox
    4. Derived XML Schemas
    5. Adding XML Markup to a Document (1/2)
    6. Adding XML Markup to a Document (2/2)
    7. Transforming the XML Back into Something Meaningful via XSLT (1/2)
    8. Transforming the XML Back into Something Meaningful via XSLT (2/2)
    9. Conclusion
  17. Chapter 9: XML Introduction
    1. Introduction
    2. A Brief Look at Word 2003 and XML
    3. What Is XML?
      1. A Note on the Word “Document”
    4. How XML Compares with HTML
    5. XML Compared with SGML
    6. XML Development Goals
    7. XML Basics
      1. Well-Formedness Rules
      2. XML Declaration
      3. Naming Conventions
      4. XML Elements
        1. Top-Level Element (Document Element)
        2. End Tags
        3. Nested Elements
      5. XML Attributes
      6. Entity References
      7. Comments
      8. Processing Instructions
      9. Adding XML Tags in Word 2003
      10. Adding Placeholder Text
      11. Inserting XML
      12. Word 2003 XML Events
    8. A Quick Introduction to XSD Schemas
      1. Office 2003 Generalizations
      2. Validity — Beyond Well Formed
      3. DTD and XDR — A Little History
      4. Types and Elements
      5. Structure of an XSD
        1. Unique Identifiers
        2. Extension Attributes
        3. Annotation Elements
      6. Types
      7. Attributes
    9. Conclusion
  18. Chapter 10: WordprocessingML Introduction
    1. Introduction
    2. Basic WordprocessingML
      1. The w:wordDocument Element
    3. Adding Text to the Document
      1. The t (Text), r (Run), and p (Paragraph) Elements
    4. Adding Sections
    5. Inserting Breaks
    6. Creating Paragraphs
    7. Inserting Tabs
    8. Formatting Text
      1. No Mixed Content
    9. Formatting Runs of Text
    10. Formatting Paragraphs
    11. Utilizing Styles
      1. Defining Styles
      2. Extending Styles
      3. Style Properties
      4. Property Conflicts
    12. Fonts
      1. Specifying Fonts
      2. Using Fonts
    13. Conclusion
  19. Chapter 11: XSLT Introduction
    1. Introduction
    2. XSLT Stylesheets
    3. A Brief Look at HTML with XSLT
    4. Rules, Patterns, and Templates
      1. XSLT Syntax
      2. XSLT Template Details
      3. Processing Instructions
    5. The Microsoft Transform Inference Tool
      1. Repeating Elements in Your Seed Document
      2. Applying an XSLT Transformation while Saving a Document
    6. Conclusion
  20. Chapter 12: SmartDocs Introduction
    1. Introduction
    2. What Is a Smart Document?
      1. Overview of a Smart Document Solution
      2. Smart Document Components
    3. Introduction to Developing Smart Documents
      1. Smart Document Architecture
      2. The Schema Library
      3. Implementing the ISmartDocument Interface
      4. Introduction to Working with Smart Document Controls
        1. Regular Controls
        2. Document Fragment Controls
        3. Help Controls
        4. Hyperlink Controls
        5. Image Controls
        6. Additional Controls
        7. ActiveX Controls
    4. Maintaining the State of Smart Document Controls
      1. Information Stored within the Document
      2. Global Variables
      3. Using Custom Document Properties or Docvariables
    5. A Quick Look at a Very Simple Smart Document
      1. The XSD File
      2. The DLL File
      3. The Solution Manifest (1/2)
      4. The Solution Manifest (2/2)
    6. Conclusion
  21. Chapter 13: More on SmartDocs
    1. Introduction
    2. Creating a DLL with VB 6.0
      1. Referencing the Smart Document Object Model
        1. Implement SmartTagLib.ISmartDocument
      2. Debugging Information
    3. What Comprises a Smart Document
    4. Smart Document Type Names
      1. Control Indexes and Control IDs
      2. Input Parameters
      3. Control Type Constants
      4. Built-In Control Properties
    5. Order of Events
      1. SmartDocInitialize Method
      2. SmartDocXMLTypeCount Property
      3. SmartDocXMLTypeName Property
      4. SmartDocXMLTypeCaption Property
      5. ControlCount Property
      6. ControlID Property
      7. ControlNameFromID Property
      8. ControlCaptionFromID Property
      9. ControlTypeFromID Property
    6. Creating and Using XML Expansion Pack Manifests
    7. Conclusion
  22. Appendix: Word Commands (1/8)
  23. Appendix: Word Commands (2/8)
  24. Appendix: Word Commands (3/8)
  25. Appendix: Word Commands (4/8)
  26. Appendix: Word Commands (5/8)
  27. Appendix: Word Commands (6/8)
  28. Appendix: Word Commands (7/8)
  29. Appendix: Word Commands (8/8)
  30. Index (1/2)
  31. Index (2/2)

Product information

  • Title: Word 2003 Document Automation with VBA, XML, XSLT, and Smart Documents
  • Author(s): Scott Driza
  • Release date: July 2005
  • Publisher(s): Jones & Bartlett Learning
  • ISBN: 9781449613259