View Single Post
 
Old 01-12-2022, 12:02 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The following adopts a slightly different approach. Change the first macro to
Code:
Sub FormatPara()
Dim oPara As Paragraph
Dim oRng As Range
    For Each oPara In Selection.Paragraphs
        Set oRng = oPara.Range
        oRng.End = oRng.End - 1
        If Len(oRng) > 2 Then
            If oRng.Characters(2) = "." Then
                oRng.MoveStart 3
                oRng.MoveStartWhile Chr(9)
                oRng.MoveStartWhile Chr(32)
                oRng.MoveStartWhile Chr(160)
            End If
            If InStr(1, oPara.Range.Text, ":") > 0 Then
                oRng.Collapse 1
                oRng.MoveEndUntil ":"
            End If
            TrueTitleCase oRng
            oRng.Characters(1).Case = wdUpperCase
        End If
    Next oPara
lbl_Exit:
    Set oPara = Nothing
    Set oRng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote