Thread: [Solved] macro problems
View Single Post
 
Old 03-24-2021, 07:02 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,980
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Along with Paul's corrections, I would also expect problems with a single line of VBA growing beyond limits. You can reduce the likelihood of that being an issue by simplifying the quote marks and concatenating chunks into separate lines.
Code:
Sub FillerWords()
  ' Highlights filler words
  Dim i As Long, sList As String, TargetList() As String
  sList = "admit|all off|as being|as to whether|as yet|care about|go on|grateful every day|if you need to|"
  sList = sList & "if you want|if you wish|if you would like to|I might add|in terms of|in my opinion|"
  sList = sList & "in spite of that fact that|in the event of|in the event that|in the process of|it seems like|"
  sList = sList & "made it to|pick out|pick up on|play up|point out|put off|put together|really|spend|take action to|"
  sList = sList & "takes up|taking up|talk about|the most important thing is to|the reason|time and again|took up|"
  sList = sList & "try to figure out|went back over|when it comes to|which is|who is|will be different|you can|"
  sList = sList & "you're going to|you're going to have|you're going to need to|in general|mostly|sort of|virtually|"
  sList = sList & "often|I think|absolutely|definitely|very|totally|literally|just|ironically|truly|actually|basically|"
  sList = sList & "to know|I see|I feel|I hear|I can feel|almost|all of|factor|for all intents and purposes|for the most part|"
  sList = sList & "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"
  
  TargetList = Split(sList, "|")
  
  Options.DefaultHighlightColorIndex = wdPink
  With ActiveDocument.Content.Find
    .MatchCase = False
    .MatchWholeWord = True
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Wrap = wdFindContinue
    .ClearFormatting
    .Replacement.ClearFormatting
    .Replacement.Highlight = True
    For i = LBound(TargetList) To UBound(TargetList)
      .Text = TargetList(i)
      .Execute Replace:=wdReplaceAll
    Next
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia

Last edited by Guessed; 03-24-2021 at 09:15 PM. Reason: Fixed spelling mistake 'simplying'
Reply With Quote