Microsoft Word 2003 Visual Basic macros
Most of these are essentially the same as the
WordBasic 6.0 versions except
that these are in Visual Basic. They still call the old WordBasic functions, by prepending "WordBasic." to each
Each link below goes to the project page, which has a more complete description, code listing, and a
download link if the project is large.
Stand-alone macros generally useful within MSWord
|Strip extra whitespace from a file
||Remove leading, trailing, or internal whitespace from the lines of a file.
|Embedded control characters
||Old archived disk files sometimes contain embedded control characters
such as printer control codes. These macros allow you to manipulate
embedded control codes: strip them out, make them visible, convert them to
printable characters, or embed new ones.
||Manage carriage returns in a file. Change WordStar soft carriage returns
to Word paragraph marks. Remove unwanted extra carriage returns from a file. Easily
modified to do other transformations.
|Strip backspace characters from a file
||Old disk files containing text from modem capture buffer routines often contain embedded
intermingled with the characters they backspaced over. Example: this^H^Hese.
This macro removes the backspace characters and the characters they
backspaced over, leaving only the final-form text.
|Mapdown (strip) parity bits in a file
||Yet another routine to zero bit 8 (parity) of all chars in file so all
chars have ASCII values < 128. For cleaning up log files of modem sessions.
|Edit a C or C++ file in MSWord
||Makes it easier to edit a C or C++ file in Word. It attaches my
CPROGRAM.DOT template to the current document, making its CPP toolbar and macros
available, changes the font to Courier New 10 (a monospaced font), and sets
the tab stops to 1/3" (4 spaces). One of the macros in CPROGRAM.DOT allows
reformatting the entire file for improved readability.
||Miscellaneous small macros: AllCapitals makes a selection all capitals;
DocMaximizeToggle can be assigned to key F5 so Word toggles Maximize/Restore
like the Borland IDE; SETBookmarkTEMP, GOTOBookmarkTEMP, and
MoveBlockToBookmarkTEMP moves a currently selected block to bookmark TEMP;
Grep does a Grep-like search (well, sort of) within the active document;
TabIn tabs in a line or block, using TAB chars; TabOut tabs out a line or
block, by removing TAB chars; ScrollTextDown, ScrollTextUp,
ScrollToWindowBottom scroll the document window without moving the cursor;
QuoteFirstString and ToDatabase do some simple processing of text before
importing into a database.
Microsoft Word 2003 Templates:
Each of these pages lists macro code from a Word template and
also has a download link for obtaining the template itself.
||A template containing several macros that fix up, reformat, beautify C,
C++, and ASM source files.
Macros that are parts of other site projects:
||A complicated set of macros used by the
RECORDS.MDB database project for extracting data from free-form text and
transferring it into the correct fields of the database. A few of the subs
and functions might have some usefulness in Word macros that are not
database-related. Several of them demonstrate methods for using SQL and DDE