Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-24-2023, 10:14 AM
Bunnelope Bunnelope is offline Macro to identify and fix long sentences without commas Mac OS X Macro to identify and fix long sentences without commas Office 2021
Novice
Macro to identify and fix long sentences without commas
 
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to identify and fix long sentences without commas Macro to select multiple sentences that contain a specific word MauiTruss Word VBA 7 10-03-2018 03:46 PM
Macro to identify and fix long sentences without commas 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
Macro to identify and fix long sentences without commas Need a Macro that Combines Every 5 sentences into a paragraph jgarland Word 22 01-11-2012 11:19 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:02 AM.


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