Macros
The file Macros.dotm contains a collection of macros and classes that I have developed for Microsoft Word 2007. You can examine the contents of the template through this report, which was generated by the macro ReportTemplateInfo.Note: My copy of this file is installed in the Word start-up folder so that these macros are automatically loaded when Word is launched. I moved these macros and classes out of my Normal template into this stand-alone file.
Macros
| Macro | Module | Description |
| ColorAuto | fnWord | Set the color of the selection to automatic |
| ColorBlue | fnWord | Set the color of the selection to blue |
| ColorRed | fnWord | Set the color of the selection to red |
| CompareStyles | fnReports | Produce a report comparing the styles between two documents |
| ConvertFieldsToText | fnFields | Convert fields in the current document to text |
| ConvertReferencesToText | fnFields | Convert references to text of the form "<<reference>>" |
| ConvertRefFieldsToRefNames | fnFields | Convert references in fields to text of the form "<<name>>" |
| ConvertTextToRFC | fnConversion | Format the current document as an Internet RFC |
| ConvertTOCtoText | fnWord | Convert the Table of Contents to text |
| CopyFont | fnWord | Copy the font styling of the current selection |
| DelinkPicture | fnWord | Find the next picture and disconnect it from the source document |
| DisplayInformation | fnWord | Display information about the current selection (Selection.Information) |
| DisplaySaveDate | fnWord | Display the last saved time for the current document |
| DisplaySelection | fnWord | Display the current selection (as text and codes) |
| DisplayStartUpLocation | fnWord | Display the location where Word looks for add ins |
| DisplayTemplateLocation | fnWord | Display the location where Word looks for document templates |
| EmitCodeForAllHeadings | fnEmitCode | Create calls to ResetNumbering that match the current document list levels |
| EndOfCell | fnWord | Moves the cursor to the end of the current cell |
| FindAutomaticallyResize | fnSearch | Find the table or cell that is set to automatically resize |
| FindAutomaticPageBreak | fnSearch | Find the next automatic page break in the document |
| FindEmptyCell | fnSearch | Find the next empty cell in the document |
| FindEmptyRow | fnSearch | Find the next row in the document where all cells are empty |
| FindFieldsOfZero | fnFields | Find fields in the current document where the text is "0" |
| FindFlag | fnSearch | Find next instance of **#** |
| FindMarker | fnSearch | Find next instance of <<>> |
| FindRevisionBy | fnRevisions | Find revisions made by a specific author |
| FindRowAboveHeight | fnSearch | Find the next row that exceeds a certain height |
| FindRowBreakable | fnSearch | Find the next row in the document where "Allow row to break..." is set |
| FindRowNotKeepWithNext | fnSearch | Find the next row in the document where "Keep with next" is not set |
| FindRowSized | fnSearch | Find the next row in the document where the height is set manually |
| FixBoldFields | fnFields | Find fields with bold formatting and turn it off |
| HideFieldCodes | fnWord | Turn off the display of field codes |
| HowTo | aDocumentation | Show tricks and tips for Visual Basic |
| NewFaxForm | NewFaxForm | Generate a new fax form |
| PasteFont | fnWord | Paste the font styling into the current selection |
| PastePlain | fnWord | Paste the clipboard exactly (without "Smart Cut and Paste") |
| ReportBookmarks | fnReports | Produce a report of the bookmarks in the current document |
| ReportBuiltinProperties | fnReports | Produce a report of the properties of the current document |
| ReportReferences | fnReports | Produce a report of references required by the current document |
| ReportStylesAllWithDescriptions | fnReports | Produce a report of all known styles and their descriptions |
| ReportStylesBuiltin | fnReports | Produce a report listing the built-in styles |
| ReportStylesNotInUse | fnReports | Produce a report listing the styles that are not used in the current document |
| ReportStylesReallyInUse | fnReports | Produce a report listing the styles used in the current document |
| ReportStylesReallyInUseWithDescriptions | fnReports | Produce a report listing the styles used in the current document and their descriptions |
| ReportTemplateInfo | ReportTemplateInfo | Produce a report with information about a template |
| ReportTemplateMacrosAsHTML | ReportTemplateInfo | Produce HTML tables with macro and class entry lists |
| ReportWhoRevised | fnRevisions | Produce a report showing every author who made revisions to the current document |
| RevisionsAccept | fnRevisions | Accept the revisions of the current selection |
| RevisionsAcceptFields | fnRevisions | Accept revisions of fields (typically generated as a result of printing while revisions are turned on) |
| RevisionsAcceptOld | fnRevisions | Accept revisions of changes made before a user-specified date |
| RevisionsAcceptRefFields | fnRevisions | Accept revisions of reference fields |
| RevisionsDelete | fnRevisions | Convert the selection to deleted text |
| RevisionsFindNewest | fnRevisions | Find the newest revision in the current document |
| RevisionsHide | fnRevisions | Turn off the display of revision marks |
| RevisionsInsert | fnRevisions | Convert the selection to inserted text |
| RevisionsNext | fnRevisions | Go to the next revision |
| RevisionsOff | fnRevisions | Turn off revision marking |
| RevisionsOn | fnRevisions | Turn on revision marking |
| RevisionsPrevious | fnRevisions | Go to the previous revision |
| RevisionsReject | fnRevisions | Reject the revisions of the current selection |
| RevisionsReview | fnRevisions | Review the current revision (author and date) |
| RevisionsShow | fnRevisions | Turn on the display of revision marks |
| SelectNextPara | fnWord | Select the next paragraph |
| SelectPara | fnWord | Select the entire paragraph containing the cursor |
| SelectToEndOfCell | fnWord | Select text from the cursor to the end of the current cell |
| SelectToStartOfCell | fnWord | Select text from the start of the current cell to the cursor |
| ShowComments | fnWord | Show the comments pane |
| ShowEndnotes | fnWord | Show the endnotes pane |
| ShowFieldCodes | fnWord | Turn on the display of field codes |
| ShowFootnotes | fnWord | Show the footnotes pane |
| ShowRevisions | fnWord | Show the revisions pane |
| StartOfCell | fnWord | Move the cursor to the beginning of the current cell |
| TableNext | fnWord | Go to the next table |
| TablePrevious | fnWord | Go to the previous table |
| TryAllFonts | fnReports | Produce a report showing a user-selected string rendered in all available fonts |
Classes
| Class | Description |
| Context | saves information so that macros do not inadvertently change the experience the user has after a macro ends |
| FindFont | defines an object mimicing Find that can be passed to Lib.Find or Lib.FindReplace |
| FindReplacement | defines an object mimicing FindReplacement that can be passed to Lib.Find or Lib.FindReplace |
| Lib | utility functions and routines for use by macros |
| Report | supports generation of macro reports |
Class: Context
| Entry Point | Description |
| Purge | purges bookmarks left behind by saved locations |
| Restore | restores location, Edit->Find, revision marking, and screen updating |
| RestoreFind | restores the state of the Edit->Find dialog |
| RestoreLocation | restores the cursor position |
| Save | saves location, Edit->Find, revision marking, and screen updating |
| SaveFind | saves the state of the Edit->Find dialog |
| SaveLocation | saves the cursor position |
Class: FindFont
| Entry Point | Description |
| ClearFormatting | clears all formatting |
Class: FindReplacement
| Entry Point | Description |
| CopyFrom | copies fields into the object |
| CopyTo | copies fields out of the object |
| ClearFormatting | clears all formatting |
Class: Lib
| Entry Point | Description |
| AddVBAExtensibility | enables "Microsoft Visual Basic for Applications Extensibility" |
| AdvanceLocation | advances to the next location (returns boolean) |
| AdvanceToLocation | advances to the next location (returns location or atEnd) |
| AtEndOfDocument | returns a boolean value indicating if the cursor is at the end of the document. |
| BringToTop | activates a window and brings it to the front of all other document windows |
| CellHeight | returns the approximate height (in points) of the active cell |
| CopyFont | saves information about the font characteristics of the selection |
| CurrentCell | returns the active cell |
| DuplicateBorders | copies one Border object to another [except line styles] |
| DuplicateFont | copies one Font/FindFont object to another |
| DuplicateParagraphFormat | copies one ParagraphFormat object to another [except TabStops] |
| DuplicateStyle | copies one Style object to another |
| EndOfCell | returns a boolean value indicating if the cursor is at the end of a cell. |
| FieldToBookmark | extracts the bookmark name from a field and returns the bookmark |
| Find | searches the document for text (with optional formatting) |
| FindReplace | replaces text in the document (with optional formatting) |
| FormatText | formats a string with the values of special characters |
| GoToContent | positions the cursor at the start of the document body |
| GoToLocation | positions the cursor in the requested location |
| Location | returns the location of the cursor |
| NewDocument | creates a new document with requested template, orientation, and margins |
| NextCell | advances the selection to the next cell (if any) in the current table |
| NextHeaderFooter | advances to the next header or footer (if any) |
| NextLocation | returns the next location for the cursor |
| NextRow | selects the next row in the current table |
| NextSearchable | advances to the next searchable location |
| NextTextBox | advances to the next text box (if any) |
| PasteFont | applies information about the font characteristics of the selection |
| PreviousCell | returns the previous cell (if any) in the current table |
| PreviousRow | selects the previous row in the current table |
| SelectNextChunk | selects the next chunk (paragraph or cell) in the document |
| SelectPara | selects the current paragraph |
| SelectToEndOfCell | selects from the cursor to the end of the current cell |
| SelectToStartOfCell | selects from the cursor to the start of the current cell |
| SetView | changes the view of the ActiveWindow and returns the previous state |
| ShowConsole | shows the debugging console (Notepad) |
| ShowText | displays a message box showing the values of special characters |
| StartOfCell | moves the cursor to the start of the current cell |
| status | sets the text in the status dialog |
| StatusStopPushed | returns True if the user pressed the Stop button in the status dialog |
| StepLocation | steps within the current location or advances to the next location |
| TableNext | moves the cursor to the next table in the document |
| TablePrevious | moves the cursor to the previous table in the document |
| TopMost | makes a window stay on top of of all other windows |
| WriteToConsole | writes a string to the debugging console (Notepad) |
Class: Report
| Entry Point | Description |
| Activate | activates the report window |
| AddCell | sets the text of the next table cell |
| AddTable | adds a table to the report |
| Document | returns the report's Document object |
| Emit | inserts a string into the report |
| EndTable | ends the table being added to the report |
| Font | returns the Font object for the current selection in the report |
| Format | formats the report: orientation, margins, and template |
| Heading | adds a heading to the report |
| MoveLeft | moves the cursor left within the report |
| MoveRight | moves the cursor right within the report |
| SelectAll | selects the entire report |
| Selection | returns the current selection in the report |
| StyleHeading | sets the style that will be used for report headings |
| StyleReport | sets the style that will be used for report text |
| Warn | inserts a warning string (with red text) into the report |
Documentation
Additional documentation can be found in the inline comments.Send me reports of any errors or suggestions you have about my VBA modules.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
