#1
|
|||
|
|||
Macro to identify and fix long sentences without commas
I would like to find (or make) a macro that will identify (highlight) long run-on sentences that haven't been broken up with commas. Let's say 25+ words in a row without any commas. I have found a macro that will do something similar- it will find long sentences, but it will only identify long stretches between periods. I want to find the run on sentences where the author (not me, but text that I copy/paste into word) failed to break of the sentence into bite sized pieces by using commas. For instance:
He went to the bank and withdrew two hundred dollars before going to the store and buying a turkey for Thanksgiving dinner at his grandparents house in Tallahassee Florida on Thanksgiving day in 2019. Here is the macro I found for long sentences. Is there a way to modify it to do what I want it to do? Code:
Sub Mark_LongSentences() Dim iMyCount As Integer Dim iWords As Integer Dim mySent If Not ActiveDocument.Saved Then ActiveDocument.Save End If 'Reset counter iMyCount = 0 'Set number of words iWords = 30 For Each mySent In ActiveDocument.Sentences If mySent.Words.Count > iWords Then mySent.Font.Color = wdColorRed iMyCount = iMyCount + 1 End If Next MsgBox iMyCount & " sentences longer than " & _ iWords & " words." End Sub Last edited by Charles Kenyon; 03-24-2023 at 11:25 AM. Reason: some formatting on macro |
|
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 |