• Missing full stops and semicolons at end of paragraphs in Word 2010

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Missing full stops and semicolons at end of paragraphs in Word 2010

    Author
    Topic
    #504989

    I am trying to quality control some updated house style documents and wondered whether there was a quick way of checking for missing full stops (or semi-colons for lists) at the end of paragraphs or to just highlight the paragraph marks that have no punctuation. Thanks Shelley

    Viewing 4 reply threads
    Author
    Replies
    • #1556911

      What is a “full stop”?

      If you know exactly what character should (or should not) be in a certain spot, you can do a manual search for those characters. You could also do a Find-and-Replace, to replace the incorrect characters with the correct ones.

      Group "L" (Linux Mint)
      with Windows 10 running in a remote session on my file server
      • #1556927

        A full stop is what I call a period. (Like the one at the end of the previous sentence.)

        I do not know how to search for everything except a certain character.

        Turning ondisplay of non-printing formatting marksmay help.

        • #1556941

          A full stop is what I call a period. (Like the one at the end of the previous sentence.)

          I was thinking more along the lines of CR-LF (carriage return – line feed). You could likely search for that, since it is a specifically-defined character string.

          I do not know how to search for everything except a certain character.

          I guess I was unclear — I meant to say search for specific characters, whether they are the ones you want to keep or the ones you want to eliminate.

          Turning ondisplay of non-printing formatting marksmay help.

          Ah! Reveal Codes! I’ve been looking for Reveal Codes for years in Word, and all this time it was right in front of me.

          Group "L" (Linux Mint)
          with Windows 10 running in a remote session on my file server
          • #1557006

            Hi
            I worked on a series of punctuation fix tools a year or two ago. My focus was to apply and correct punctuation in bulleted lists, especially styles that used “;” or “,” and want the second to last line to have “; and” inserted and the last line ending in “.”. I found doing this to be a pain, especially when I had to edit the list and then reapply the “,and” rules. With the tool, all you need to do is hit a shortcut key anywhere in the list and the rule format is correctly reapplied to the list – it saves a great deal of low value editing time.

            I don’t leave many body text paragraphs without a training “.” character. What I do find is that when I use tables to quickly record information, I often forget the “.” and may leave an extra blank line at the end of the cell. I developed another tool which adds the “.” to cell paragraphs if it is missing, and removes these blank lines for each of the selected cells in a table. This is a real time saver as it can process an entire table in one keystroke.

            In both cases the tools step through each paragraph checking the last character. This isn’t as slow as it may sound. One of the challenges is determining the boundaries of a bulleted list so only that list is processed, especially in document with numbered paragraphs. As always, doing this in the context of table cells also has its challenges, because Word uses hidden characters to denote cell boundaries.

            I have added the driving loop for the punctuation fix and table format code below to give some idea of the processing. There are other supporting routines not shown because because there is a lot of exception handling. You can download the full routines for free at DocumentProductivity. There are many other word editing enhancements also available there.

            Code:
            [SIZE=1]Private Sub wrkPunctFix(iPara As Long, ilastPara As Long, iMethod As Integer)
            ‘=========================================================================================================================
            [B]‘Fixes the punctuation for the paragraph and format type passed[/B]
            ‘Release 09 Aug 2014 Martin Coomber documentproductivity.blogspot.co.nz
            ‘Deletes trailing and, then deletes any existing punctuation
            ‘Then adds the punctuation characters required for each rule
            ‘=========================================================================================================================
                Dim iChar As Integer
                Dim rPara As Range
                Dim sInputVal As String
                Dim bDeleteWrongTerminatingChar As Boolean
                
                Set rPara = ActiveDocument.Paragraphs(iPara).Range
                  
                ‘Process the start of the Para
                If iMethod = 3 Then
                   rPara.Characters(1).Select
                    If Selection.Range.Case = wdLowerCase _
                    Then Selection.Range.Case = wdUpperCase
                End If
                
                ‘Now process text at the end of the line – works for end table cell too
                iChar = rPara.Characters.Count – 1 ‘dont process end of para character
                While rPara.Characters(iChar).Text = ” ”
                    rPara.Characters(iChar).Select
                    Selection.Delete ‘ but does not seem to delete the last space in a para
                    iChar = iChar – 1 ‘ Handle blanks at end and table cChars
                Wend
               
                ‘Delete and
                rPara.Characters(iChar).Select
                Selection.MoveStart Unit:=wdCharacter, Count:=-3
                If Selection.Text = ” and” Then
                    Selection.Delete Unit:=wdCharacter, Count:=1
                    iChar = iChar – 4
                End If
                
                ‘Delete terminating character
                If InStr(“.;, “, rPara.Characters(iChar).Text) > 0 Then
                    rPara.Characters(iChar).Select
                    Selection.Delete Unit:=wdCharacter, Count:=1
                    iChar = iChar – 1
                End If
                
                rPara.Characters(iChar).Select
                Select Case iMethod ‘ now add characters
                    Case 1 ‘;
                        If iPara  (ilastPara) Then Selection.InsertAfter “;”
                        If iPara = (ilastPara – 1) Then Selection.InsertAfter ” and”
                        If iPara = (ilastPara) Then Selection.InsertAfter “.”
                    Case 2 ‘,
                        If iPara  (ilastPara) Then Selection.InsertAfter “,”
                        If iPara = (ilastPara – 1) Then Selection.InsertAfter ” and”
                        If iPara = (ilastPara) Then Selection.InsertAfter “.”
                    Case 3 ‘.
                        Selection.InsertAfter “.”
                    Case 4 ‘ on last line only
                        If iPara = (ilastPara) Then Selection.InsertAfter “.”
                End Select
                
                If iPara = ilastPara Then ‘Position cursor at end
                    ActiveDocument.Paragraphs(ilastPara).Range.Characters.Last.Previous.Select
                    Selection.Collapse Direction:=wdCollapseEnd
                End If
                
            End Sub

            ===============================
            Format each cell in a range
            ==============================

            For Each cCell In rSelect.Cells
            While wrkCellRemoveTrailingBlankLines(cCell) ‘ clean up cell
            Wend
            ‘Skip cells in Row 1 ‘
            If cCell.ColumnIndex >= iColStart And cCell.ColumnIndex 1 Then
            For Each pPara In cCell.Range.Paragraphs
            iCnt = iCnt + 1
            StatusBar = “Smart Format ” & iCnt

            iChar = pPara.Range.Characters.Count – 1 ‘dont process end of para character
            If iChar > 0 Then
            While pPara.Range.Characters(iChar).Text = ” ”
            pPara.Range.Characters(iChar).Select
            Selection.Delete ‘ but does not seem to delete the last space in a para
            iChar = iChar – 1 ‘ Handle blanks at end and table cChars
            Wend
            End If
            If iChar >= 1 Then ‘ check if not a blank line
            pPara.Range.Characters(iChar).Select
            bAddPeriod = True
            If bAddPeriod And InStr(“.:;?!,”, Selection.Text) > 0 Then bAddPeriod = False
            If bAddPeriod And Selection.Range.Bold 0 Then bAddPeriod = False
            If bAddPeriod Then
            Selection.MoveStart Unit:=wdCharacter, Count:=-2
            If Selection.Text = ” or” Then bAddPeriod = False
            End If
            If bAddPeriod Then
            Selection.MoveStart Unit:=wdCharacter, Count:=-1
            If Selection.Text = ” and” Then bAddPeriod = False
            End If
            If bAddPeriod Then Selection.InsertAfter “.”
            ‘ handle and/or
            End If ‘ test for not a blank line
            Next pPara
            End If ‘test for skip cols/rows
            Next cCell
            rSelect.Select[/SIZE][/CODE]

          • #1557017

            ***

            Ah! Reveal Codes! I’ve been looking for Reveal Codes for years in Word, and all this time it was right in front of me.

            For more, see Shift+F1 Reveal Formatting.

    • #1557007

      You could do a wildcard Find, where:
      Find = [!^13.:;?!]^13
      This will highlight any paragraph that doesn’t end with .:;? or !

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

      • #1557013

        Thank you Macropod, this is probably what I need as I can add this wildcard search to my highlight macro. I have set my highlight macro to show any punctuation missing in pink, digits in yellow and everything else in green (please see the attached document).

        I am trying to insert at the beginning of the macro to first delete white space after paragraphs so that the macro does not highlight any punctuation already present.

        Is there also a way to tell the macro to only highlight if there is one space after a fullstop/question mark and ignore if there are already two spaces.

        The reason for this macro is to perform quality control checks only and not to find and replace anything, only to highlight the mistakes in the documents so I can visually see what is wrong and make a report.

        Code:
        Sub DPU_QAHighlightPunctuation()
        Application.ScreenUpdating = False
        Dim strFnd As String, i As Long
        With ActiveDocument.Range.Find
          .ClearFormatting
          .Replacement.ClearFormatting
          .Forward = True
          .Wrap = wdFindContinue
          .MatchCase = False
          .MatchWholeWord = True
          .MatchWildcards = False
          .MatchSoundsLike = False
          .MatchAllWordForms = False
          .Replacement.Text = “^&”
          .Replacement.Highlight = True
          Options.DefaultHighlightColorIndex = wdYellow
           .MatchWildcards = True
          .Text = “[0-9[]^0145^0146^0147^0148]{1,}”
          .Replacement.Text = “^&”
          .Execute Replace:=wdReplaceAll
          .Execute Replace:=wdReplaceAll
         .Text = “[ ]([,:;.)])”
          .Execute Replace:=wdReplaceAll
            Options.DefaultHighlightColorIndex = wdGreen
           .Text = “([.?])[  ]”
           .Execute Replace:=wdReplaceAll
           Options.DefaultHighlightColorIndex = wdPink
           .Text = “([!^13.:;?!]^13)”
           .Execute Replace:=wdReplaceAll
        End With
         ActiveWindow.View.ShowFieldCodes = True
          With Selection.Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .Replacement.Highlight = False
            .Text = “^d”
            .Replacement.Text = “”
            .Forward = True
            .Wrap = wdFindContinue
            .Format = True
            .MatchCase = False
            .MatchWholeWord = False
            .MatchWildcards = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False
            .Execute Replace:=wdReplaceAll
          End With
          ActiveWindow.View.ShowFieldCodes = False
        Application.ScreenUpdating = True
        End Sub
        • #1557288

          I am trying to insert at the beginning of the macro to first delete white space after paragraphs so that the macro does not highlight any punctuation already present.

          Is there also a way to tell the macro to only highlight if there is one space after a fullstop/question mark and ignore if there are already two spaces.

          Try:

          Code:
          Sub DPU_QAHighlightPunctuation()
          Application.ScreenUpdating = False
          With ActiveDocument.Range.Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .Forward = True
            .Format = False
            .Execute
            .Wrap = wdFindContinue
            .MatchWildcards = False
            .Replacement.Highlight = False
            'Delete fields
            ActiveWindow.View.ShowFieldCodes = True
            .Text = "^d"
            .Replacement.Text = ""
            .Execute Replace:=wdReplaceAll
            ActiveWindow.View.ShowFieldCodes = False
            'Highlight digits, square backets & smart quotes
            .Text = "^p^w"
            .Replacement.Text = "^p"
            .Execute Replace:=wdReplaceAll
            .MatchWildcards = True
            .Replacement.Highlight = True
            Options.DefaultHighlightColorIndex = wdYellow
            'Highlight digits, square backets & smart quotes
            .Text = "[0-9[]^0145^0146^0147^0148]{1,}"
            .Replacement.Text = "^&"
            .Execute Replace:=wdReplaceAll
            'Highlight spaces followed by punctuation
            .Text = "[^s ]([,:;.)])"
            .Execute Replace:=wdReplaceAll
            Options.DefaultHighlightColorIndex = wdGreen
            'Highlight punctuation not followed by two ordinary spaces
            .Text = "([.?])[^s ][! ]"
            .Execute Replace:=wdReplaceAll
            Options.DefaultHighlightColorIndex = wdPink
            'Highlight characters other than paragraph breaks or punctuation followed by a paragraph break
            .Text = "([!^13.:;?!]^13)"
            .Execute Replace:=wdReplaceAll
          End With
          Application.ScreenUpdating = True
          End Sub

          PS: You really should comment your code, so you’ll know what each part does later on.
          Note: I deleted your final Find/Replace as it doesn’t actually do anything.

          Cheers,
          Paul Edstein
          [Fmr MS MVP - Word]

          • #1571918

            Hi all, I would like to update my missing punctuation macro further with the following:

            1. ignore paragraphs/headings in bold text;
            2. ignore instances of paragraphs that end with semi-colons and the words ‘or’ and ‘and’ e.g. ‘; or’ or ‘; and’

            Is this at all possible to include in the coding below please. Many thanks

            Code:
            ‘is there any punctuation missing’
            Options.DefaultHighlightColorIndex = wdPink   
            .Text = “([!^13.:;?!]^13)”
               .Execute Replace:=wdReplaceAll
      • #1572083

        You could do a wildcard Find, where:
        Find = [!^13.:;?!]^13
        This will highlight any paragraph that doesn’t end with .:;? or !

        Hi Macropod
        Is there a way of also ignoring any bold text before a paragraph mark, I’m struggling with the coding for this.
        Thanks Shelley

    • #1571922

      It occurs to me that the Grammarly Add-In for Word and Outlook may well provide this functionality as well.

      • #1571923

        Hi Charles, thanks for the reply but I have absolutely no idea what that means unfortunately – I am not a coder I simply quality control documents for house style and have put together a highlight macro which quickly shows me what is wrong with the document in a variety of colours – the particular bit I’m looking to update is highlighting where missing punctuation is in pink but I want it to ignore any text in bold which are usually clause headings and also when paragraphs end with
        ; or / ; and – thanks Shelley

      • #1573671

        I thought that Grammarly sounded interesting, so I downloaded the install file. A while later, I got an email informing me of the “plans”. They range from about $12 a month (paid annually) to $30 a month (paid monthly).

    • #1571927

      See Grammarly for Office. I am confident it will find most punctuation anomalies.

      • #1571935

        See Grammarly for Office. I am confident it will find most punctuation anomalies.

        Hi Charles
        Thanks for this, unfortunately my company have put administration restrictions on anything being downloaded so I am unable to use this. Thanks anyway – Shelley

    • #1571937

      Good luck with your macro solution, then.

    Viewing 4 reply threads
    Reply To: Missing full stops and semicolons at end of paragraphs in Word 2010

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: