Word Duplication Macro
by Eric Gans
One of the worst sins of writing is the inadvertent repetition of the same or similar words in near proximity. This macro looks for duplicate words (and word beginnings) in a text file. It highlights each duplicate in turn and allows you to edit the file as you go along; you can go through the file a second or third time if you like.
Installation Instructions
-
Download the file wdrep.zip
to your computer. (Right-click on the link, then go to Save Target As..)
-
Extract the three files: wdrep.bas, WdRepForm.frm, and WdRepForm.frx
.
-
Open Word, then type Alt-F11 to open the Visual Basic window.
-
Type Ctl-M to open the Import File window.
-
Import wdrep.bas and WdRepForm.frm from the directory to which you
extracted them in (2) (two separate operations).
NB: Since the only function of the three lines of wdrep.bas is to load the "frm" file, you may find it easier to include this subroutine in your default macro module (automatically called "NewMacros").
-
Return to Word by clicking on the "W" icon.
The wdrep macro is now installed. It can be accessed through the Tools menu,
or by typing Alt-F8.
Customizing
There are four Const expressions in the WdRepForm.frm file (available to edit after installation via Alt-F11) that may be changed to reflect your preferences:
- Const minwd% = 3
This is the shortest word that will be checked.
- Const leftwd% = 4
This is the number of characters that will be checked in words longer than the minimum word.
- Const dno% = 25
This is the maximum distance between duplicate words. If you increase the previous constant, you may wish to increase this one also.
- Const workdir = "C:\temp\"
This tells the macro where to put the word lists it creates.
Disclaimer
This macro should work with any version of MSWord from 95 to XP; nothing is guaranteed, of course. Please report any bugs to me.
Eric Gans /
gans@humnet.ucla.edu
Last updated: