Created
September 7, 2019 12:04
-
-
Save kmondesir/74e555cccda35706072a779a158fc59b to your computer and use it in GitHub Desktop.
Counts groups of words and highlights them in a word document
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub HitHighLighter3() | |
'Modified to include a count of all words found in the document. | |
'Modified 24 May 2014 by Kino Mondesir | |
Dim words() As Array, list As String, wholeDocument As Range, list as Dictionary, report As String, _ | |
source As String, destination As String | |
words = Split(InputBox("Word HitHighLighter", "Please enter each word separated by a comma") , ",") | |
list = New Dictionary | |
source = Environ("UserProfile") & "\" & "Documents" & "\" & "Input" | |
destination = Environ("UserProfile") & "\" & "Documents" & "\" & "Output" | |
For Each word in words | |
With list | |
.CompareMode = BinaryCompare | |
.Add Key:=word, Item:=wordcounter(word) | |
End With | |
Next | |
For Each word in words | |
report = report & word & ":" & vbTab & list.item(word) & vbNewLine | |
total = total + list.item(word) | |
Next | |
report = report & "total" & ":" & vbTab & total | |
MsgBox report, vbOKOnly, "Count of Each Word in List" | |
WriteToText destination, ActiveDocument.Name & ".txt", report | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment