Showing posts with label editors. Show all posts
Showing posts with label editors. Show all posts

Tuesday, October 16

Check Your Writing For Adverbs And Other Problem Words: MS Word Macros

Check Your Writing For Adverbs And Other Problem Words: An MS Word Macro

Today I'm going to do something a bit different. I'm going to talk about how you can augment MS Word's ability to check grammar. Yes there are professional editing programs that do all this, and more, but sometimes you don't want to copy and paste your story into an online editor, especially if it's a 100,000 word novel!

Before I bought my new computer I had a macro for MS Word that highlighted "ly" adverbs, as well as other problem words, that clutter up your writing. For instance, "very", "that", "much".

I love the quotation, attributed to Mark Twain, "Substitute 'damn' every time you're inclined to write 'very'; your editor will delete it and the writing will be just as it should be."

Unfortunately, when I transfered my data over to my new computer I forgot my macros so they all went to the great macro heaven in the sky. Now keep them in Dropbox, lesson learnt.

This post has two parts. First, I'll show you the macros I use and then I'll go through how to use them in MS Word.

Let's get started!

The Macro: Finding "ly" Adverbs


The following macro will highlight all the "ly" words in your manuscript. I wanted to make it highlight the entire word, but at the moment it only highlights the "ly" part of it. Oh well, it works! The original macro, written by Subcortical over at Stackoverflow, can be found here: Microsoft Word Macro for highlighting multiple words.

Sub highlight_ly()
   Options.DefaultHighlightColorIndex = wdYellow
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Highlight = True
    With Selection.Find
        .Text = "ly"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchSuffix = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub

Here's another macro that finds, and highlights, words that often serve only to clutter text. The original macro was written by Subcortical and can be found in the same article I linked to, above.
Sub highlight_targets()
  Dim range As range
  Dim i As Long
  Dim TargetList

  TargetList = Array("very", "that") ' put list of terms to find here

  For i = 0 To UBound(TargetList)

    Set range = ActiveDocument.range

    With range.Find
    .Text = TargetList(i)
    .Format = True
    .MatchCase = True
    .MatchWholeWord = True
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False

    Do While .Execute(Forward:=True) = True
    range.HighlightColorIndex = wdTurquoise
    Loop
    End With
  Next
End Sub

Using the macros


I have MS Word 2007, so keep that in mind if you're using a different version.

1) Go into MS Word and click "View" on the ribbon.

2) On the far right of the ribbon you'll see MACROS. Click it.

3) A Macro dialog box pops up. Type in the macro name "highlight_ly" and click CREATE. This will bring you into the Microsoft Visual Basic editor.

4) Copy this text:

   Options.DefaultHighlightColorIndex = wdYellow
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Highlight = True
    With Selection.Find
        .Text = "ly"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchSuffix = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Now paste it between "Sub highlight_ly" and "End Sub".

5) Save the file (Crtl + S) and exit the Microsoft Visual Basic editor.

6) In MS Word repeat steps (1) and (2). This time instead of typing in a name and pressing the create button, select "highlight_ly" and press RUN. All the words ending in "ly" should be highlighted in yellow.

If you would like to also highlight words such as "this" and "that" repeat steps (1) through (6) only this time for the macro "highlight_targets". Note that the "highlight_targets" macro can be modified to include whatever words you'd like to highlight. All you have to do is include the words in the TargetList array.

I hope that's clear! (I can hear folks grumbling, "Yea, clear as mud!") If you have questions, do ask, and if there are any macros you'd like to share, please do!

Other articles you might like:
- Penelope Trunk: Blogging And Branding
- How To Design A Great Looking Book Cover
- The Best Way To Build A Writer's Platform Is To Write
- Aftermath Of The Department of Justice Lawsuit: Amazon Customers Getting Refunds

Links:
- Here's a great article on the passive voice from The University of North Carolina.

Photo credit: Catherinette Rings Steampunk.