Okay, here's a rough approximation of what I think you want.
1. Create your word list in an excel spreadsheet in column A starting in A1
2. Every time you add a word you need to Save the workbook
3. The program will only recognise unique words so if you have "evaluate" in your list it will not find "evaluated" or "evaluating". you will have to enter these separately.
4. The Word macro should be place in the Normal/NewMacros module
5. In the Macro screen click on Tools/Reference and make sure that "Microsoft Excel 12.0 Object Library" is ticked (the number may be different)
6. Paste the following code into the NewMacros module
7. Go to Word Options/Cutomise and click on the arrow next to the top input area and select "Macros"
8. You should see Normal.NewMacros.WordFrequency .... select it and click on "Add" and then OK - this will allow you to run the macro from the Quick Access toolbar in Word
Open the student document you want to analyse and click on the new icon in the Quick Access Toolbar and it will do its thing - may take up to a minute or more for larger documents > 1000 words. In the end it will create a new Word file with the results.
Chances are that I may have missed a few steps in the above but if you run into any troubles just come back and ask.
Enthusiast/Nosparks et al .... the code is messy and contains stuff not needed. Also it will only present words that have been used and the number of times each has been used. It will not present the words that weren't used. This may actually be better if the list of words gets really long.
Here is the Macro .....
Sub WordFrequency()
Const maxwords = 9000 '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 '
Dim workBook As workBook
Dim DataInExcel
Dim NoRows
Dim NRows As Integer
Set workBook = Workbooks.Open("C:\users\MG\!Mydoqs\HTG\NewWords.xlsx", True, True) 'Enter the path and file name of your Excel file
NoRows = workBook.Worksheets("Sheet1").Range("A1").End(xlDown).Row
DataInExcel = workBook.Worksheets("Sheet1").Range("A1:A" & NoRows)
' 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
For i = 1 To UBound(DataInExcel)
' 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 SingleWord = DataInExcel(i, 1) Then
' If Len(SingleWord) > 5 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
Next
' Now write out the results
tmpName = ActiveDocument.AttachedTemplate.FullName
Documents.Add Template:=tmpName, NewTemplate:=False
Selection.ParagraphFormat.TabStops.ClearAll
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 used out of a total of " & NoRows, vbOKOnly, "Finished")
End Sub
========================================================================
Thanks to this site for direction on how to get stuff from Excel from a Word Macro and of course the site mentioned in the previous post that had all the Word codes.