Thread: [Solved] macro problems
View Single Post
 
Old 03-24-2021, 06:14 PM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

There are multiple problems with your code, above all, the liberal use of smart quotes in the array. The structure is also poor. Try:
Code:
Sub FillerWords()
Application.ScreenUpdating = False
Dim i As Long, h As Long, TargetList
h = Options.DefaultHighlightColorIndex: Options.DefaultHighlightColorIndex = wdPink
TargetList = Array("admit", "all off", "as being", "as to whether", "as yet", "care about", "go on", _
  "grateful every day", "if you need to", "if you want", "if you wish", "if you would like to", _
  "I might add", "in terms of", "in my opinion", "in spite of that fact that", "in the event of", _
  "in the event that", "in the process of", "it seems like", "made it to", "pick out", "pick up on", _
  "play up", "point out", "put off", "put together", "really", "spend", "take action to", "takes up", _
  "taking up", "talk about", "the most important thing is to", "the reason", "time and again", "took up", _
  "try to figure out", "went back over", "when it comes to", "which is", "who is", "will be different", _
  "you can", "you’re going to", "you’re going to have", "you’re going to need to", "in general", "mostly", _
  "sort of", "virtually", "often", "I think", "absolutely", "definitely", "very", "totally", "literally", _
  "just", "ironically", "truly", "actually", "basically", "to know", "I see", "I feel", "I hear", _
  "I can feel", "almost", "all of", "factor", "for all intents and purposes", "for the most part", _
  "for the purpose of", "harder than it has to be", "individual", "initial", "on a regular basis", _
  "the first step is to", "time and time again", "with reference to")
With ActiveDocument.Content.Find
  .Format = False
  .MatchCase = False
  .MatchWholeWord = True
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = False
  .Replacement.Text = "^&"
  .Replacement.Highlight = True
  For i = 0 To UBound(TargetList)
    .Text = TargetList(i)
    .Execute Replace:=wdReplaceAll
  Next
End With
Options.DefaultHighlightColorIndex = h
Application.ScreenUpdating = True
End Sub
PS: When posting code, please structure your code and use the code tags, indicated by the # button on the posting menu. Without the code tags, your posted code loses much of whatever structure it had.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote