Lately I have been writing articles for Monitor computer magazine. When I analyzed what I have written and what lector changed, I easily built a list of words I should avoid.
Since I'm developer I believe that software can help. So I have written three Word macros to help me avoid those words and phrases in my articles.
With three buttons on toolbar and three keyboard shortcuts fixing articles before turning them in is a piece of cake!
I only need to maintain a text file with suspicious words and their suggested substitutes. Format is super simple. Here are few sample lines:
ampak|temveč
blog|spletni dnevnik
direkt*|neposredn*
idej*|zamisel
Finally, here is the VBA code for three macros.
MarkForForbiddenWords opens a file with words I try to avoid and suggestions, reads line by line and marks found words with green squiggles.
Sub MarkForbiddenWords()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Replacement.Text = "^&"
.MatchWildcards = True
End With
With Selection.Find.Replacement.Font
.Underline = wdUnderlineWavyDouble
.UnderlineColor = wdColorSeaGreen
End With
intUnit = FreeFile
' change to correct path!
Open "C:\Users\David\Documents\checklist.txt" For Input As #intUnit
Do While Not EOF(intUnit)
Dim strBuffer As String
Line Input #intUnit, strBuffer
s = Split(strBuffer, "|")
With Selection.Find
.Wrap = wdFindContinue
.Text = s(0)
.Replacement.Text = Replace(s(0), "*", "") & " [" & s(1) & "?]"
.Execute Replace:=wdReplaceAll
End With
DoEvents
Loop
End Sub
NextMarkedForbiddenWord is much simpler, it just finds occurrence of text with green squiggles.
Sub NextMarkedForbiddenWord()
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.Font.Underline = wdUnderlineWavyDouble
.Font.UnderlineColor = wdColorSeaGreen
End With
Selection.Find.Execute
End Sub
CleanUpForbiddenWords cleans things up as they were.
Sub CleanUpForbiddenWords()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.Font.Underline = wdUnderlineWavyDouble
.Font.UnderlineColor = wdColorSeaGreen
End With
With Selection.Find.Replacement
.Text = ""
.Font.Underline = wdUnderlineNone
.Font.UnderlineColor = wdColorAutomatic
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Another couple of minutes saved!