For my 103 class, one of the main aspects that I evaluate is the student’s ability to use academic English. Therefore, a large portion of my marking time is spent identifying register issues, which mainly manifest as uses of casual or imprecise language and personal pronouns.
Looking at the time I spent highlighting the same words and expressions again and again, I felt like one of the people in black-and-white segments of infomercials: there has to be a better way.
I thought about Word’s “Search” function but the idea of looking up more than 50 different expressions one at a time seemed like more work than simply highlighting as I read.
After some research, I found out that it was possible to program a macro in Word that would search and highlight a list of words or expressions from a reference file. Then, all that would be left for me to do is to come up with a list (or lists) of terms or expressions considered too casual for an academic essay and I could have a Word macro highlight them all for me!
Video tutorial explaining how to program and run the macro. (Music in the video: Overblow, Ketsa)
Programming the macro
First, you will need to go into Microsoft Word’s macro menu. To access it, either go through the “View” tab in Word’s top menu or use the search bar and select “View Macros”.
The Macros menu can be found in the “View” tab in Word’s top menu.
In the Macros menu, enter the title of your macro in the bar at the top and then click on “Create”.
In the Macros menu, enter the macro’s name, then click on “Create”.
This will open Visual Basic and display your new, blank, macro. At this point, the macro only includes the title you have entered, and the start and end functions.
The words after “Sub” is the title of your macro. It is how you will find it in your list of macros.
At this point, you need to copy/paste the code below into Visual Basic. Double-check that you only have one instance of “Sub” and “End Sub” in your code or you will receive an error message if you try to run it. If “Sub” and “End Sub” appear in double after the copy/pasting, delete 1 of each.
Dim objListDoc As Document
Dim objTargetDoc As Document
Dim objParaRange As Range, objFoundRange As Range
Dim objParagraph As Paragraph
Dim strFileName As String
strFileName = InputBox("Enter the full name of the list document here:")
Set objTargetDoc = ActiveDocument
Set objListDoc = Documents.Open(strFileName)
For Each objParagraph In objListDoc.Paragraphs
Set objParaRange = objParagraph.Range
objParaRange.End = objParaRange.End - 1
' Find target items.
.Text = objParaRange
.MatchWholeWord = True
.MatchCase = False
' Highlight the found items.
Do While .Find.Found
Set objFoundRange = Selection.Range
objFoundRange.HighlightColorIndex = wdBrightGreen
Now, according to my correction code, register issues are always highlighted in turquoise. To change the colour used to highlight the text, we are going to go to the last block of the code and find the line: “objFoundRange.HighlightColorInder = wd”. The word or words after “wd” dictate the colour of the highlighting. Therefore, for my example, I would need to change the line of code to: “objFoundRange.HighlightColorInder = wdTurquoise”.
The color of the highlighting can be modified by changing the word after “= wd”.
There are ways to customize the colours available for highlighting but I have always found the basic colours to be more than sufficient. Some simple basic colours you can input after “wd” are:
Now, if you have done everything properly, when you run the macro – either through the Macros menu or an assigned shortcut key – a window will pop up to prompt you to enter the full name of the list document.
To run your newly-programmed macro, you need to find it in your list of macros, select it, and click on “Run”.
If the reference lists you are using are in your “Documents” folder, you only need to type in the full name of the file, i.e. “Register.docx”.
If you download reference lists provided below, they should appear in your “Downloads” folder. You will need to move them to “Documents” for Word to detect them properly using the file name only.