Navigation Bar

HOME  |   ABOUT ME  |   MERM-8  |   DISNEY VILLAINS  |   VIDEO GAME MEMORIES  |   OTHER WORKS

Quote Generator



Wednesday, April 14, 2010

Macro 3: Find instances of "it's" and "its"

UPDATE: This post has been amended.  You can find the complete list of writer's macros here.

Here's a real simple one. It finds and highlights all instances of the word "it's" and "its". Thanks to my hypervigilance, I never used to make mistakes like replacing "it is" with "its". But I guess I'm getting older, and I keep getting feedback that says I've used the wrong "its/it's". This will point out each one so you can quick review them. I read the phrase, and replace the word in my head with "it is". If it sounds right, the word should be "it's". If not, the word should be "its".

(In my defense, I never get "their/they're/there" or "your/you're" wrong. What use is a blog if you can't stroke your ego every once in a while?)


'Highlight instances of its and it's
Sub Find_Its()
Application.Run MacroName:="Clear_All_Highlighting"

Dim rng As Range
oldHighlight = Options.DefaultHighlightColorIndex

For Each rng In ActiveDocument.StoryRanges
rng.Find.ClearFormatting
rng.Find.Replacement.ClearFormatting
rng.Find.Forward = True
rng.Find.Replacement.Highlight = True
rng.Find.Format = True
rng.Find.MatchCase = False
rng.Find.MatchWholeWord = True
rng.Find.MatchWildcards = False
rng.Find.MatchSoundsLike = False
rng.Find.MatchAllWordForms = False
rng.WholeStory
rng.Find.Text = "it's"
rng.Find.Wrap = wdFindStop
Options.DefaultHighlightColorIndex = wdTeal
Do While rng.Find.Execute
rng.Select
Selection.Range.HighlightColorIndex = wdTeal
Loop

rng.Find.ClearFormatting
rng.Find.Replacement.ClearFormatting
rng.Find.Forward = True
rng.Find.Replacement.Highlight = True
rng.Find.Format = True
rng.Find.MatchCase = False
rng.Find.MatchWholeWord = True
rng.Find.MatchWildcards = False
rng.Find.MatchSoundsLike = False
rng.Find.MatchAllWordForms = False
rng.WholeStory
rng.Find.Text = "its"
rng.Find.Wrap = wdFindStop
Options.DefaultHighlightColorIndex = wdTurquoise
Do While rng.Find.Execute
rng.Select
Selection.Range.HighlightColorIndex = wdTurquoise
Loop
Next rng

Options.DefaultHighlightColorIndex = oldHighlight
'Move cursor to beginning of document
Selection.GoTo What:=wdGoToPage, Which:=wdGoToFirst
End Sub


Previous Macros:
Macro 2: Find Sentences Longer than 20 words
Macro 1: Finding Questionable Words
Post a Comment