Join | Login  

     Popular! Books, Stories, Articles, Poetry
Where Authors and Readers come together!


Featured Authors:  Belle Ami, iGwendolyn Moore, iRichard Hardie, iTiffany Turner, iTemple Williams, iDenise Nowakowski, iErnie Heavin, i

  Home > Mystery/Suspense > Articles Popular: Books, Stories, Articles, Poetry     

John Patrick Lamont

· Become a Fan
· Contact me
· Books
· Articles
· 8 Titles
· 1 Reviews
· Save to My Library
· Share with Friends!
Member Since: Apr, 2008

John Patrick Lamont, click here to update your pages on AuthorsDen.

Featured Book
Fresh Frozen (hardcover and eBook )
by Darden North

In Darden North's FRESH FROZEN, human reproductive tissue becomes a murderous commodity. FRESH FROZEN (hardcover, October 2008) is the third thriller by award-winning aut..  
BookAds by Silver
Gold and Platinum Members

Featured Book
Bugstompers of The 21st Century
by Terry Vinson

What’s that crawling up your leg? Not to worry…it’s not half as deadly, or ravenous, as the slimy mutation slithering into your ear canal! Fear not, despisers of all thi..  
BookAds by Silver
Gold and Platinum Members

   Recent articles by
John Patrick Lamont

Burnt Offerings – Sacrificing Insurance and Investment Clients
Client Enslavement Using Golden Handcuffs and Intimidation
Corporate Body Snatching and Client Rustling
Help For Word Frequency Macro
Register Your Copyright Electronically
The Worst Kind of Lies
           >> View all

Style Sheets - Author's Writing Tools
by John Patrick Lamont   
Rated "G" by the Author.
Last edited: Saturday, May 03, 2008
Posted: Saturday, May 03, 2008

Share    Print   Save    Become a Fan

Build effective style sheets with this handy MS Word macro.

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



 Sub WordFrequency1()


' 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

    End If


    Selection.HomeKey Unit:=wdStory

    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 = ""

        End If

        'On exclude list?

        If InStr(Excludes, "[" & SingleWord & "]") Then

            SingleWord = ""

        End If

        If Len(SingleWord) > 0 Then

            Found = False

            For j = 1 To WordNum

                If Words(j) = SingleWord Then

                    Freq(j) = Freq(j) + 1

                    Found = True

                    Exit For

                End If

            Next j

            If Not Found Then

                WordNum = WordNum + 1

                Words(WordNum) = SingleWord

                Freq(WordNum) = 1

            End If

            If WordNum > maxwords - 1 Then

                j = MsgBox("Too many words.", vbOKOnly)

                Exit For

            End If

        End If

        ttlwds = ttlwds - 1

        StatusBar = "Remaining: " & ttlwds & ", Unique: " & WordNum

    Next aword


    ' 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

        Next 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

        End If

        StatusBar = "Sorting: " & WordNum - j

    Next j


    ' Now write out the results

    tmpName = ActiveDocument.AttachedTemplate.FullName

    Documents.Add Template:=tmpName, NewTemplate:=False


    With Selection

        For j = 1 To WordNum

            .TypeText Text:=Trim(Str(Freq(j))) _

              & vbTab & Words(j) & vbCrLf

        Next j

    End With

    System.Cursor = wdCursorNormal

    j = MsgBox("There were " & Trim(Str(WordNum)) & _

      " different words ", vbOKOnly, "Finished")

End Sub

Web Site: Sum Of Life Books

Want to review or comment on this article?
Click here to login!

Need a FREE Reader Membership?
Click here for your Membership!

After by Peter Mulraney

After is the first book in the Inspector West series. It's a murder mystery/romance novel introducing Inspector Carl West...  
Featured BookAds by Silver
Gold and Platinum Members

The Quest for the Prize by Keith Dyne

A thrilling mystery set in England. Jerry Dumbarton is on a quest to find the prize, an ancient object that will bring love and happiness to the race of man...  
Featured BookAds by Silver
Gold and Platinum Members

Authors alphabetically: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Featured Authors | New to AuthorsDen? | Add AuthorsDen to your Site
Share AD with your friends | Need Help? | About us

Problem with this page?   Report it to AuthorsDen
© AuthorsDen, Inc. All rights reserved.