Visual Basic for Applications/Word

This lesson introduces Word macros.

Objectives and Skills
Objectives and skills for Word scripting include:
 * Using Microsoft Word objects

Readings

 * 1) Microsoft: Inserting Text in a Document
 * 2) Microsoft: Document Properties
 * 3) Microsoft: Built-In Document Properties
 * 4) Microsoft: Built-In Document Property Constants

Activities
In these activities you will create macros which interact with Word documents.


 * 1) Document Properties
 * 2) Create a macro that inserts document information (properties) at the bottom of the active document.  There could be several valid approaches to this solution, but one method would be to use the Document Range property. The information listed below is available either as a document property directly, or is included in the BuiltInDocumentProperties.  Your macro should include Option Explicit.  Your inserted information should include the following.
 * 3) * Document Name
 * 4) * Path
 * 5) * Title
 * 6) * Subject
 * 7) * Author
 * 8) * Last Author
 * 9) * Creation Date
 * 10) * Revision Number
 * 11) * Total Editing Time
 * 12) * Number of Paragraphs
 * 13) * Number of Words
 * 14) * Spelling Errors
 * 15) * Grammatical Errors
 * 16) Custom Footer
 * 17) Insert a custom footer into the active document.  The footer should include the document's full path and filename on the left, and the date the file was last saved on the right.
 * 18) Custom Footer with Fields
 * 19) Repeat Activity 2 inserting a custom footer into the active document that includes the document's full path and filename and date the file was last saved.  Now implement the macro as an AutoOpen macro, and use Word fields to insert the filename and date last saved.  Ensure that the macro tests to see if a footer is already in the document, and does nothing if a footer already exists.