![]() |
|
#5
|
|||
|
|||
|
(Added prior to above being posted)
Here is a macro to select the first long sentence found and suggest that it be changed. Note, even with commas added, it would trigger the suggestion. Code:
Sub LongSentencesQuery()
' Charles Kenyon
' points out long sentences, asks for changes
' https://www.msofficeforums.com/174325-post3.html
'
Dim iMyCount As Long
Dim i As Long
Const iWords As Long = 30
Dim rSent As range
' Save active document before making changes
If Not ActiveDocument.Saved Then
ActiveDocument.Save
End If
'Reset counter iMyCount = 0
'Set number of words
Let iMyCount = ActiveDocument.Sentences.Count
For i = 1 To iMyCount
Set rSent = ActiveDocument.Sentences(i)
If rSent.Words.Count > iWords Then
MsgBox "The sentence: " & rSent.Text & " is long, consider breaking it up into smaller sentences."
rSent.Select
Exit Sub
End If
Next i
Set rSent = Nothing
End Sub
It selects the problem sentence but does not mark it. |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro to select multiple sentences that contain a specific word
|
MauiTruss | Word VBA | 7 | 10-03-2018 03:46 PM |
Macro to number sentences
|
tjf816 | Word VBA | 10 | 03-29-2017 05:42 PM |
| A Widlcard or Macro to Properly Remove Spaces Between Commas? | CrossReach | Word | 6 | 01-23-2017 04:28 AM |
Need a Macro that Combines Every 5 sentences into a paragraph
|
jgarland | Word | 22 | 01-11-2012 11:19 AM |