Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Finding long sentences (2003)

    I'm looking for a way to find long sentences in a 149-page document. Our stylebook says we should avoid sentences longer than 18 words. I've found one sentence with 60 words, and I'd like to find all sentences with a word count of 20 or more. How would I write a macro to do this chore? Thanks!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Finding long sentences (2003)

    Here is a basic example. You can adapt it to your needs.

    Sub HighlightLongSentences()
    Dim rng As Range
    For Each rng In ActiveDocument.Sentences
    If rng.ComputeStatistics(wdStatisticWords) > 19 Then
    rng.HighlightColorIndex = wdYellow
    End If
    Next rng
    End Sub

    This macro highlights long sentences in yellow, but you can replace the instruction rng.HighlightColorIndex = wdYellow with other code.

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Finding long sentences (2003)

    Marvelous! Works like a champ!

    Thank you, Hans! <img src=/S/salute.gif border=0 alt=salute width=15 height=20>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •