View Single Post
 
Old 03-24-2023, 10:14 AM
Bunnelope Bunnelope is offline Mac OS X Office 2021
Novice
 
Join Date: Mar 2023
Posts: 5
Bunnelope is on a distinguished road
Default 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
Reply With Quote