Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-24-2021, 07:02 PM
Guessed's Avatar
Guessed Guessed is offline macro problems Windows 10 macro problems Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,159
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
  #2  
Old 03-24-2021, 07:38 PM
macropod's Avatar
macropod macropod is offline macro problems Windows 10 macro problems Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,366
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

Quote:
Originally Posted by Guessed View Post
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 simplying the quote marks and concatenating chunks into separate lines.
True, but that isn't an issue with the OP's code warranting such an approach.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
macro problems Footnote extraction macro [Why is this macro so slow? / anyway to make it faster?] Le_Blanc Word VBA 10 03-22-2021 11:38 AM
Problems with Macro for inserting autotext when autotext name isn't followed by a space amz1950 Word VBA 0 02-14-2018 10:20 AM
Macro problems with Word for Mac 2016 16.9.1 JML Word VBA 2 02-03-2018 01:14 PM
Spell check macro within macro button field doesn't work in one document samuelle Word VBA 0 07-20-2016 02:27 AM
Cutting and Pasting and Macro problems in Excel 2010 enkel Excel Programming 3 01-02-2012 10:15 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:14 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft