dexterousy
10-30-2014, 07:38 AM
Hey everyone,
I am pre-novice at VBA, so I would appreciate if I can get some help in creating a macro for the following scenario:
I have a list of technical words/phrases with their alternatives (for illustration purposes, see below)
Paper - report, transcript, summary
Financial documents - balance-sheet, income statement, forecast, budget
Expert - professional, teacher, experienced
Each word has other alternatives (synonyms) and what I would like to do it create a macro such that whenever I run it (on a word file), it highlights all the occurrences of the words and displays the list of those words and their alternatives at the bottom of the document (preferably separated by a line)
But only the words used in the document should be displayed. For example, if a document had "financial" and "expert" in it, then these words with all their alternatives should be displayed and since "paper" was not in the document macro should skip that.
Any thoughts how I can do that macro for word?
Any input is highly appreciated!
Below is the macro I have for highlighting words so far. I will like to add more coding to this and the suggested replacements for the highlighted words.
Sub rkis()
Dim range As range
Dim i As Long
Dim TargetList
TargetList = Array("expert", "assist", "review", "compile", "confirm", "audit", "attest", "assurance", "certify", "examine", "verify", "validate", "in our opinion", "ensure", "guarantee", "satisfy", "ascertain/know your needs", "best possible", "best efforts", "highest standards", "unequalled", "incomporable", "maximize", "optimize", "minimize", "determine", "select", "incomparable", "subject matter expert", "state-of-the-art", "cutting-edge", "Partner with", "Optimum solution", "the solution will achieve", "to your satisfaction", "will meet all your needs", "negotiate", "identify any issues", "validate the plan", "we will develop a series of workshops", "we will prepare slides and materials to be used during the workshops", "we will assist in the completion of the three-year Plan") ' put list of terms to find here
For i = 0 To UBound(TargetList)
Set range = ActiveDocument.range
With range.Find
.Text = TargetList(i)
.Format = True
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
Do While .Execute(Forward:=True) = True
range.HighlightColorIndex = wdYellow
Loop
End With
Next
End Sub
I am pre-novice at VBA, so I would appreciate if I can get some help in creating a macro for the following scenario:
I have a list of technical words/phrases with their alternatives (for illustration purposes, see below)
Paper - report, transcript, summary
Financial documents - balance-sheet, income statement, forecast, budget
Expert - professional, teacher, experienced
Each word has other alternatives (synonyms) and what I would like to do it create a macro such that whenever I run it (on a word file), it highlights all the occurrences of the words and displays the list of those words and their alternatives at the bottom of the document (preferably separated by a line)
But only the words used in the document should be displayed. For example, if a document had "financial" and "expert" in it, then these words with all their alternatives should be displayed and since "paper" was not in the document macro should skip that.
Any thoughts how I can do that macro for word?
Any input is highly appreciated!
Below is the macro I have for highlighting words so far. I will like to add more coding to this and the suggested replacements for the highlighted words.
Sub rkis()
Dim range As range
Dim i As Long
Dim TargetList
TargetList = Array("expert", "assist", "review", "compile", "confirm", "audit", "attest", "assurance", "certify", "examine", "verify", "validate", "in our opinion", "ensure", "guarantee", "satisfy", "ascertain/know your needs", "best possible", "best efforts", "highest standards", "unequalled", "incomporable", "maximize", "optimize", "minimize", "determine", "select", "incomparable", "subject matter expert", "state-of-the-art", "cutting-edge", "Partner with", "Optimum solution", "the solution will achieve", "to your satisfaction", "will meet all your needs", "negotiate", "identify any issues", "validate the plan", "we will develop a series of workshops", "we will prepare slides and materials to be used during the workshops", "we will assist in the completion of the three-year Plan") ' put list of terms to find here
For i = 0 To UBound(TargetList)
Set range = ActiveDocument.range
With range.Find
.Text = TargetList(i)
.Format = True
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
Do While .Execute(Forward:=True) = True
range.HighlightColorIndex = wdYellow
Loop
End With
Next
End Sub