View Single Post
 
Old Today, 07:27 AM
RobiNew RobiNew is offline Windows 11 Office 2016
Competent Performer
 
Join Date: Sep 2023
Posts: 229
RobiNew is on a distinguished road
Default

Thanks, Macropod! But I posted the wrong version. Please check this one with regard to period deletion.
Code:
Sub FormatAndDeleteNew()
'Format left titles
For Each oPar In ActiveDocument.Paragraphs
    If oPar.Range.ComputeStatistics(wdStatisticLines) = 1 _
         And oPar.Range.ParagraphFormat.Alignment = wdAlignParagraphLeft _
         And Not oPar.Range Like "*[0-9]*" Then
'If above conditions are true, then delete possible period and apply style
    If oPar.Range.Characters.Last.Previous = "." Then oPar.Range.Characters.Last.Previous = vbNullString
      oPar.Range.Style = "LeftTitle"
    End If
Next oPar
End Sub

Last edited by macropod; Today at 01:13 PM. Reason: Added code tags
Reply With Quote