Being largely self-taught, I have spent a lot of time searching the Internet for tools to improve my writing. Here's one I'd like to share that I found especially useful for building style sheets.
To build my style sheets for my book, Sum of Life - The Worst Kind of Lies, I needed a fast and easy way to identify the unique words in my manuscript. Once created, my style sheet was given to my copy-editor and proofreaders to decrease confusion about what word I intended and to eliminate wasted time with unnecessary corrections. I've found that the word processor’s grammar, punctuation and spell checker wasn't useful for much more than a first or second pass through a document. Many times it not only caused confusion, but also suggested the wrong solution. A good style sheet is a handy time saving tool that everyone involved in the production of the manuscript can use.
Since I use MS Word, I assumed that using an automating macro was a logical way to build my style sheet. The last thing I wanted to do was to spend hours poring through the book trying to separate unique words. Unfortunately, my programming skills are limited. I can understand the logic within someone else's program and possibly alter it, but the actual creation of anything complex is beyond me. Luckily, a few searches on the Internet yielded a site with handy programming tips for MS Word.
Allen Wyatt's site contains macros for many applications. The one that helped me was the word frequency macro.
What this macro does is identify all unique words in a document, count how many times the words are used and then list them with their usage alphabetically on a separate Word document. When you run the macro, it gives you a choice to sort either by word or frequency. Frequency lists the most commonly used words first. Word lists the words in alphabetical order.
In my case with a 500+ word manuscript, the macro created a single column document of over 250 pages. Once the list of unique words was created, I not only had the raw data for building my style sheet, but I found I could use the list as a secondary spell checker. By scanning through the list I was able to find correctly spelled yet redundant words, words I mistakenly told the spell checker to ignore, and words that may have been used too often. The macro gave me a fast and effective way of analyzing my writing.
Personally, I find that the verb "said" quickly becomes monotonous when reading fiction. Since the macro adds up all the occurrences of each word, it gives me a handy reference to how much editing of "said" words is necessary. Other verbs like "thought" and "asked" are also examples that are handy to have a count of. Substituting more interesting, diverse and more descriptive verbs is a simple matter using the Find feature in MS Word.
Unfortunately, the macro isn’t perfect. My style sheet needed even more help from the word count macro, but, because of its limitations, it took a little extra work to get it. Proper hyphenation better communicates the true intended definition of many words, but the macro ignores hyphens. The easiest solution for me to add hyphenated words to my style sheet was to use Find and Replace. By simply Find(ing) all the hyphens and Replace(ing) them with a six-digit number (like 867345), when I ran the macro, my raw data list of unique words included words like good867345looking. Once the new list of words was created, reversing the Find and Replace restored all the hyphens and made the list good-looking!
A minor change I made to the original macro program was to expand the amount of words it would find and process, plus I needed it to find and count some rather unusually spelled slang words that began with an apostrophe. An example would be “’bout” for the properly spelled word “about.” Since the slang was intended to be included in the style sheet, altering the macro program made it an even more useful tool for my purposes.
Below is the fully altered MS Word macro for your use. Since I only altered it, I take no credit or responsibility for its use. Make sure all your work is backed up before trying it. If you do not know how to copy this program and paste it into the Microsoft Visual Basic editor, I suggest you read your manual to familiarize yourself with the procedures.
I hope this helps.
John Patrick Lamont
' WordFrequency1 Macro
Const maxwords = 20000 'Maximum unique words allowed
Dim SingleWord As String 'Raw word pulled from doc
Dim Words(maxwords) As String 'Array to hold unique words
Dim Freq(maxwords) As Integer 'Frequency counter for unique words
Dim WordNum As Integer 'Number of unique words
Dim ByFreq As Boolean 'Flag for sorting order
Dim ttlwds As Long 'Total words in the document
Dim Excludes As String 'Words to be excluded
Dim Found As Boolean 'Temporary flag
Dim j, k, l, Temp As Integer 'Temporary variables
Dim ans As String 'How user wants to sort results
Dim tword As String '
' Set up excluded words
Excludes = "[the][a][of][is][to][for][by][be][and][are]"
' Find out how to sort
ByFreq = True
ans = InputBox("Sort by WORD or by FREQ?", "Sort order", "WORD")
If ans = "" Then End
If UCase(ans) = "WORD" Then
ByFreq = False
System.Cursor = wdCursorWait
WordNum = 0
ttlwds = ActiveDocument.Words.Count
' Control the repeat
For Each aword In ActiveDocument.Words
SingleWord = Trim(LCase(aword))
'Out of range?
If SingleWord < "a" Or SingleWord = "z" Then
SingleWord = ""
'On exclude list?
If InStr(Excludes, "[" & SingleWord & "]") Then
SingleWord = ""
If Len(SingleWord) > 0 Then
Found = False
For j = 1 To WordNum
If Words(j) = SingleWord Then
Freq(j) = Freq(j) + 1
Found = True
If Not Found Then
WordNum = WordNum + 1
Words(WordNum) = SingleWord
Freq(WordNum) = 1
If WordNum > maxwords - 1 Then
j = MsgBox("Too many words.", vbOKOnly)
ttlwds = ttlwds - 1
StatusBar = "Remaining: " & ttlwds & ", Unique: " & WordNum
' Now sort it into word order
For j = 1 To WordNum - 1
k = j
For l = j + 1 To WordNum
If (Not ByFreq And Words(l) < Words(k)) _
Or (ByFreq And Freq(l) > Freq(k)) Then k = l
If k <> j Then
tword = Words(j)
Words(j) = Words(k)
Words(k) = tword
Temp = Freq(j)
Freq(j) = Freq(k)
Freq(k) = Temp
StatusBar = "Sorting: " & WordNum - j
' Now write out the results
tmpName = ActiveDocument.AttachedTemplate.FullName
Documents.Add Template:=tmpName, NewTemplate:=False
For j = 1 To WordNum
.TypeText Text:=Trim(Str(Freq(j))) _
& vbTab & Words(j) & vbCrLf
System.Cursor = wdCursorNormal
j = MsgBox("There were " & Trim(Str(WordNum)) & _
" different words ", vbOKOnly, "Finished")